JavaSE basis (b) - Java environment configuration

Java development environment configuration

In this section we will introduce how to build a Java development environment.


window system installed java

Download JDK

First we need to download java development kit JDK, download address: http://www.oracle.com/technetwork/java/javase/downloads/index.html , click on the download button below:

In the download page, you need to choose to accept the license, and select the corresponding version of the system according to their paper to Window 64-bit systems, for example:

JDK installation according to prompts to download, install JDK when there will install the JRE, install it together.

Installation JDK, installation can customize the installation directory and other information, for example, we select the installation directory is  C: \ Program Files (x86) \ the Java \ jdk1.8.0_91 .

Configuration environment variable

1. After installation is complete, right-click "My Computer", click "Properties", select "Advanced System Settings";

2. Select the "Advanced" tab, click on the "Environment Variables";

Then the screen will appear as shown below:

Set three properties in the "System Variables", JAVA_HOME, PATH, CLASSPATH (capitalization does not matter), If there is already then click the "Edit" does not exist, click "New."

Note: If you use version 1.5 or later of the JDK, do not set the CLASSPATH environment variable can be properly compile and run Java programs.

Variable is set to the following parameters:

  • Variable name: JAVA_HOME
  • 变量值:C:\Program Files (x86)\Java\jdk1.8.0_91        // 要根据自己的实际路径配置
  • 变量名:CLASSPATH
  • 变量值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;         //记得前面有个"."
  • 变量名:Path

  • 变量值:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

JAVA_HOME 设置

PATH设置

注意:在 Windows10 中,Path 变量里是分条显示的,我们需要将 %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; 分开添加,否则无法识别:

%JAVA_HOME%\bin; %JAVA_HOME%\jre\bin;

更多内容可参考:Windows 10 配置Java 环境变量

若是安装JDK12,则需要自己手动安装jre,安装步骤为:

 (1)运行上面生成JRE的命令的时候,CMD窗口路径显示的为: C:\Program Files\Java\jdk-12.0.1>: ,运行的命令为:bin\jlink.exe --module-path jmods --add-modules java.desktop --output jre,运行 的位置和路径一定要一致。

​ (2)在启动cmd命令行的时候最好使用管理员的身份运行。

CLASSPATH 设置

这是 Java 的环境配置,配置完成后,你可以启动 Eclipse 来编写代码,它会自动完成java环境的配置。

测试JDK是否安装成功

1、"开始"->"运行",键入"cmd";

2、键入命令: java -versionjavajavac 几个命令,出现以下信息,说明环境变量配置成功;


Linux,UNIX,Solaris,FreeBSD环境变量设置

环境变量PATH应该设定为指向Java二进制文件安装的位置。如果设置遇到困难,请参考shell文档。

例如,假设你使用bash作为shell,你可以把下面的内容添加到你的 .bashrc文件结尾: export PATH=/path/to/java:$PATH


流行JAVA开发工具

正所谓工欲善其事必先利其器,我们在开发java语言过程中同样需要一款不错的开发工具,目前市场上的IDE很多,本文为大家推荐以下下几款java开发工具:

Guess you like

Origin www.cnblogs.com/fzsz086/p/11939287.html