当windows下安装多个jdk版本时,方便在各给版本之间切换,每个版本写成一个bat文件,要切换到那个版本就运行那个版本的bat.
1. 1.8版本java-1.8.bat
del "C:\ProgramData\Oracle\Java\javapath\java.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\java.exe" "C:\Program Files\Java\jre1.8.0_101\bin\java.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaw.exe" "C:\Program Files\Java\jre1.8.0_101\bin\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaws.exe" "C:\Program Files\Java\jre1.8.0_101\bin\javaws.exe"
2. 1.7版本java-1.7.bat
del "C:\ProgramData\Oracle\Java\javapath\java.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\java.exe" "C:\Program Files (x86)\Java\jdk1.7.0_80\bin\java.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaw.exe" "C:\Program Files (x86)\Java\jdk1.7.0_80\bin\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaws.exe" "C:\Program Files (x86)\Java\jdk1.7.0_80\bin\javaws.exe"
3. 1.6版本java-1.6.bat
del "C:\ProgramData\Oracle\Java\javapath\java.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
del "C:\ProgramData\Oracle\Java\javapath\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\java.exe" "C:\Program Files (x86)\Java\jdk1.6.0_10\bin\java.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaw.exe" "C:\Program Files (x86)\Java\jdk1.6.0_10\bin\javaw.exe"
mklink "C:\ProgramData\Oracle\Java\javapath\javaws.exe" "C:\Program Files (x86)\Java\jdk1.6.0_10\bin\javaws.exe"