一、首先,
JDK的安装路径,在这里我们选择默认安装在C:Program FilesJavajdk1.7.0_45目录下。
二、下面,
设置环境变量:
【1】“我的电脑”右键菜单--->属性--->高级--->环境变量--->系统变量--->新建
变量名:JAVA_HOME
变量值:C:Program FilesJavajdk1.7.0_45
(注意JAVA_HOME后边不带分号)
变量名:CALSS_PATH
变量值:.;%JAVA_HOME%libdt.jar;%JAVA_HOME%lib ools.jar;
【2】找到path 变量名--->“编辑”添加:
变量名:PATH
变量值:%JAVA_HOME%in;%JAVA_HOME%jrein;
三、然后,
在Windows 命令提示符下验证Java 是否成功:
【1】win+R
【2】运行cmd,回车
【3】键入java -version结果图:
【4】键入java,结果图:
【5】键入javac,结果图:
若出意外:
解决方法之一:
“我的电脑”右键菜单--->属性--->高级--->环境变量--->用户变量--->找到Path--->编辑
变量名:Path
变量值:%JAVA_HOME%in;