XP下JDK6环境变量配置

关于JAVA的安装配置已是很久的话题了,趁现在重新安装JDK,就把过程记录一下。
第一步:下载JDK6,从官网下载(http://java.sun.com/javase/downloads/index.jsp)
第二步:安装JDK6,具体按步骤进行就OK了
第三步:配置环境变量,主要是三个:JAVA_HOME、PATH、CLASSPATH。
JAVA_HOME:C:\Program Files\Java\jdk1.6.0_14;
PATH:%JAVA_HOME%\bin;
CLASSPATH:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;
以上环境变量没有的则新建添加,已经有的则编辑增加相应的值。

官方环境变量配置文档:
Update the PATH variable (Optional) You can run the JDK without setting the PATH variable, or you can optionally set it as a convenience.

Should I set the PATH variable?
Set the PATH variable if you want to be able to conveniently run the JDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. If you don't set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

    C:> "\Program Files\Java\jdk1.6.0_<version>\bin\javac" MyClass.java
It's useful to set the PATH permanently so it will persist after rebooting.

How do I set the PATH permanently?
To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:

  1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
  2. Click Advanced > Environment Variables.
  3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin
  • PATH environment variable is a series of directories separated by semi-colons (;) and is not case sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
  • You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored. If one is already present, update it to jdk1.6.0_<version>\bin.
  • If you are not sure where to add the path, add it to the right end of the PATH in the User Variables.
  • The new path takes effect in each new command window you open after setting the PATH variable.
发现其没有关于设置CLASSPATH变量的说明,查了下资料发现JDK1.3以后的版本都支持自动查找相关类,所以一般情况下就不用设置这个CLASSPATH了,当然设置该变量也是没问题的,

当然还有LINUX下安装配置JAVA环境,等有机会补充。
posted @ 2009-08-02 18:21  BlueZ  阅读(2146)  评论(0编辑  收藏  举报