|
我安装的是jdk1_2_2-linux-i386.tar.gz 系统是redhat7.3
我把jdk1_2_2-linux-i386.tar.gz拷贝到/usr/local下
(1)??解开压缩包??
tar??xvzf??jdk1_2_2-linux-i386.tar.gz
(2)??目录的处理??
ln??-s??jdk1.2.2??jdk??
ln??-s??jdk/jre??jre??
(3)??设置$JAVA_HOME,$CLASSPATH??
vi??/root/.bash_profile??
加入:??
JAVA_HOME=/usr/local/jdk??
export??JAVA_HOME??
CLASSPATH=/usr/local/jdk/lib:/usr/local/jre/lib??
export??CLASSPATH??
PATH=$PATH:/usr/local/jdk/bin:/usr/local/jre/bin??
然后在/usr/local/bin下编辑HelloWorldApp.java
vi HelloWorldApp.java
public??class??HelloWorldApp
{
public??static??void??main??(String??args[??])
{
System.out.println("Hello??World!");
}
}
[root@localhost bin]# ./javac HelloWorldApp.java
HelloWorldApp.java:1: Class or interface declaration expected.
public??class??HelloWorldApp??{
^
HelloWorldApp.java:1: Invalid character in input.
public??class??HelloWorldApp??{
^
HelloWorldApp.java:1: Invalid character in number.
public??class??HelloWorldApp??{
^
HelloWorldApp.java:2: Invalid character in input.
public??static??void??main??(String??args[??]){
^
HelloWorldApp.java:2: Invalid character in number.
public??static??void??main??(String??args[??]){
^
5 errors
[root@localhost bin]#
不知道怎么还是编译不起来????????????????????? |
|