前言 JDK环境变量设置(JDK脚本bat) 安装JDK 官网下载JDK安装 JDK8 JDK默认安装 C:\Program Files\Java\JDK 配置环境变量1234567891011121314151617181920@echo off::获取管理员权限方法一:%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitcd /d "%~dp0"::后面是jdk安装路径,更改成自己的jdk安装路径setx /M JAVA_HOME "C:\Program Files\Java\JDK"setx /M CLASSPATH ".;%%JAVA_HOME%%\lib\dt.jar;%%JAVA_HOME%%\lib\tools.jar"setx /M PATH "%PATH%;%%JAVA_HOME%%\bin"echo 设置成功java -versionpause 附录:bat脚本下载