jdk8 Configuration

Java SE Development Kit 8u241

download

https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
choose their own system of self-supported version of
Oracle account: [email protected]
Oracle password: Oracle123

installation

Be careful not to have Chinese
as it has been installed, and so we show how the directory structure of the files
Directory Structure

Configuration environment variable

Three configurations:

  1. JAVA_HOME:C:\ProgramFiles\jdk\jdk-8u241-windows-x64\jdk1.8.0_241
  2. Path:%JAVA_HOME%\bin
  3. CLASSPATH:.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;

Test whether the configuration is successful

win + r type cmd
at the command line: java -version
If the version number jdk show, then the configuration success!

The following forward what Baidu know which big brother on "Java classpath environment variable must be configured right" words (understand)

附上链接:https://zhidao.baidu.com/question/1605930365893725827.html
设置环境变量
在java 中需要设置三个环境变量(1.5之后不用再设置classpath了,但个人强烈建议继续设置以保证向下兼用问题)
JDK安装完成之后我们来设置环境变量:右击“我的电脑”,选择“属性”,选择“高级”标签,进入环境变量设置,分别设置如下三个环境变量:
(1)配置path变量:
为什么要配置path变量?因为电脑系统将根据该变量的值找到java编程中需要的一些程序,比如javac.exe、java.exe、javah.exe等等,其中javac.exe程序是用于编译java源代码,java.exe程序是用于执行后缀为class的代码。
如何配置path变量?
path变量一般电脑系统都已经创建好了,所以不用新建该变量,只需在系统变量里选中到path变量,点击“选择” ->“编辑",需要注意的是,不要随便删除方框里原有的其他path值,而是先在那一大串值之后,添加一个分号,再把C:\Program Files\Java\jdk1.5.0_17\bin填上去。下面列出其键值对:
变量名: PATH(不区分大小写但建议使用大写)
变量值: C:\Program Files\Java\jdk1.5.0_17\bin
(2)配置classpath变量:
为什么要配置classpath变量?配置classpath变量,才能使得java解释器知道到哪里去找标准类库,这些标准类库是别人已经写好了的,我们只管使用。比如我们常用到java.lang包中的类,在配置classpath变量后被设为默认导入,所以在写程序时就不用import这个包了。那么这些标准类库在哪呢?在以JDK的lib目录下以jar为后缀的文件中:一个是dt.jar,一个是tools.jar,这两个jar包都位于C:/jdk1.6.0/lib目录下,所以通常我们都会把这两个jar包加到我们的classpath环境变量的值为:.; C:\Program Files\Java\jdk1.5.0_17\lib\tools.jar; C:\Program Files\Java\jdk1.5.0_17\lib\dt.jar;
如何配置classpath变量?
在系统环境变量那一栏中点击新建classpath ,具体过程省略,下面只列出其键值对:
变量名: CLASSPATH
变量值: .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;
(注意,CLASSPATH最前面是有个 “.”的,表示当前目录。用两个%包围JAVA_HOME这个变量的意思是引用变量的值,当然如果你不想这样做,也可以这样配置classpath的值为:.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar; 也就是用JAVA_HOME变量的值替换%JAVA_HOME%);
(3)配置JAVA_HOME变量:
Why do you want to configure classpath environment variable? First, for ease of reference, for example, JDK installed in the C: \ Program Files \ Java \ jdk1.5.0_17 directory, set the directory path for JAVA_HOME, then later want to use this path when that is simply enter% JAVA_HOME% can avoid references are entered each time a long path string; two is the principle of normalization, when the JDK path to change, just change the value of the variable JAVA_HOME can, otherwise, it is necessary to change any references to the JDK directory absolute path the document, if the case does not change the whole, a program can not find the JDK, the consequences can be imagined ---- crash! three third-party software can reference a good agreement JAVA_HOME variable, otherwise, you can not the normal use of the software.
How to configure the JAVA_HOME variable?
That column click New JAVA_HOME (JAVA_HOME points to the JDK installation path) in a system environment variable, the variable's value is actually the root directory of the JDK installation path. The specific process is omitted, the following list only its key-value pairs:
variable name: JAVA_HOME
variable value: C: \ Program Files \ Java \ jdk1.5.0_17
test JDK is installed successfully
enter cmd in the Run
then type java -version
to see if java version can show you configure

Guess you like

Origin www.cnblogs.com/nightrainlemon/p/12355904.html