You can set CLASSPATH and PATH in your user directory or /etc/profile.
JAVA_HOME=/usr/java/jdk1.6.0_10JAVA_BIN=/usr/java/jdk1.6.0_10/bin
export JAVA_HOME JAVA_BIN
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:/home/frank/
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
When you use java command to run the *.class file, the system will find the file from CLASSPATH first, if not find, then the system will find it from PWD(primary work directory). When Using "java" command to run the *.class file do not with the suffix(.class), because the system will not run all the class file but just a part of the bytecode.
本文介绍如何设置Java环境变量,包括CLASSPATH和PATH等,并解释了这些变量的作用及如何使用java命令运行.class文件。
1981

被折叠的 条评论
为什么被折叠?



