1.安装JDK
![](https://upload-images.jianshu.io/upload_images/13225861-da2b2ff738502a23.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
自己创建两个文件夹用于分别安装jdk和jre,且两个文件夹在同一目录下。两次目录选择,第一次是jdk,第二次是jre
选jdk目录
![](https://upload-images.jianshu.io/upload_images/13225861-e6845ae750bac759.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-2dce887d2aa1fc59.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
选jre目录
![](https://upload-images.jianshu.io/upload_images/13225861-22db71201ac0407f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-a2edfaed925d5f0a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
完成
![](https://upload-images.jianshu.io/upload_images/13225861-b412a248d3592d50.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.配置变量
1.打开高级系统设置
![](https://upload-images.jianshu.io/upload_images/13225861-8a8122814a0dffdd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.打开环境变量
![](https://upload-images.jianshu.io/upload_images/13225861-ac08ea7f693a05cb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3.配置系统变量
在系统变量中有三个文件需要配置,如果 JAVA_HOME 和 CLASSPATH 在原系统中出现过,请先删除原值
如果没有就新建,Path配置是在最末尾添加
![](https://upload-images.jianshu.io/upload_images/13225861-0e505920a3ec747e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
CLASSPATH .;%JAVA_HOME%libdt.jar;%JAVA_HOME%lib ools.jar
![](https://upload-images.jianshu.io/upload_images/13225861-63db48b471895187.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
JAVA_HOME 找到自己创建的安装jdk的文件夹,在其中添加该目录
![](https://upload-images.jianshu.io/upload_images/13225861-28ce4fb7e84419ba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Path ;%JAVA_HOME%in;%JAVA_HOME%jrein
配置完成后可通过命令提示符(cmd)的 java javac 和 java -version 指令确认是否安装成功
![](https://upload-images.jianshu.io/upload_images/13225861-e1224abbebf017a8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-b5600ca6e6cb5d7d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-453bcf9ee7026133.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Hello World:
解压文件后,直接打开程序,进入工作空间选择
![](https://upload-images.jianshu.io/upload_images/13225861-3c86761bc3f8c11e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击file->new->other (这里的图始终传不上来)
选择java project
![](https://upload-images.jianshu.io/upload_images/13225861-a1b860bcab1f2c30.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
输入项目名
![](https://upload-images.jianshu.io/upload_images/13225861-4450c90980dcb9b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在src中创建一个包
![](https://upload-images.jianshu.io/upload_images/13225861-e738cc0b688e8989.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
给包名
![](https://upload-images.jianshu.io/upload_images/13225861-ccdedbb2556eb0c4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在包中创建一个类
![](https://upload-images.jianshu.io/upload_images/13225861-1c2e219461ea1922.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
给类名,并勾选public static void main(String[] args),表明这个类这是程序入口地址
![](https://upload-images.jianshu.io/upload_images/13225861-076678083ea85d06.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
对于黑方框,按一下 i 即可
![](https://upload-images.jianshu.io/upload_images/13225861-393fad0327ebfab8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在主函数中写下 System.out.println("Hello World!");
点击运行
![](https://upload-images.jianshu.io/upload_images/13225861-944658fc9c3d6f39.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-2653b553a904c850.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/13225861-d159e138c799618b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)