windows下JDK的环境变量配置-阿里云开发者社区

开发者社区> 开发与运维> 正文

windows下JDK的环境变量配置

简介: 到官网下载JDK的对应windows版本, 安装, 然后进行环境变量配置, 然后打开cmd.exe运行。 Updating the PATH Environment Variable

到官网下载JDK的对应windows版本。(Make sure you download the JDK, not the JRE.)
https://www.oracle.com/technetwork/java/javase/downloads/index.html
安装,进行环境变量配置。
Updating the PATH Environment Variable
If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as:

C:> "C:Program FilesJavajdk1.8.0binjavac" MyClass.java
It is useful to set the PATH variable permanently so it will persist after rebooting.

To set the PATH variable permanently, add the full path of the jdk1.8.0bin directory to the PATH variable. Typically, this full path looks something like C:Program FilesJavajdk1.8.0bin. Set the PATH variable as follows on Microsoft Windows:

Click Start, then Control Panel, then System.

Click Advanced, then Environment Variables.

Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value for the PATH variable:

C:WINDOWSsystem32;C:WINDOWS;C:Program FilesJavajdk1.8.0bin
Note:

The PATH environment variable is a series of directories separated by semicolons (;) 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 you are not sure where to add the JDK path, append it.

The new path takes effect in each new command window you open after setting the PATH variable.

打开cmd.exe运行javac查看是否已经配置OK。

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章