Switch Java JDK version scripts

Source: Internet
Author: User
Tags goto

The computer must be installed to switch versions of the JDK, you can not use the green package instead.
Copy the following to the newly created text file, the suffix is modified to the bat format, and right-click Run as Administrator

@echo Offrem Switch Java JDK version echo please switch to admin to toggle Echo Current version Java-version:menuecho =============================================  echo Please select the JDK version to switch echo 1:java jdk 1.7echo 2:java jdk 1.8echo 3: cancel Echo =============================================set/p ch= Please select: if "%ch%" = = "1" goto java1.7if "%ch%" = = "2" goto java1.8if "%ch%" = = "3" goto Exitgoto menu:java1.7set java_home=d:\ Java\jdk1.7.0_45set jre_home=d:\java\jdk1.7.0_45\jreset Java_version=1.7goto Exec:java1.8set JAVA_HOME=D:\Java\ Jdk1.8.0_144set jre_home=d:\java\jdk1.8.0_144\jreset java_version=1.8goto exec:execreg Add "HKEY_LOCAL_MACHINE\ Software\javasoft\java Development Kit "/V currentversion/t reg_sz/f/d"%java_version% "REG Add" hkey_local_machine\sof Tware\javasoft\java Runtime Environment "/V currentversion/t reg_sz/f/d"%java_version% "REG Add" Hkey_local_machine\sy Stem\currentcontrolset\control\session manager\environment "/V java_home/t reg_sz/f/d"%JAVA_HOME% "REG Add" HKEY_ Local_machine\system\currentcontrolset\control\session MAnager\environment "/V jre_home/t reg_sz/f/d"%jre_home% "del/f" C:\Windows\System32\java.exe "copy/y"%java_home%\bin \java.exe "" C:\Windows\System32\java.exe "del/f" C:\Windows\System32\javaw.exe "copy/y"%java_home%\bin\javaw.exe "" C:\Windows\System32\javaw.exe "del/f" C:\Windows\System32\javaws.exe "copy/y"%java_home%\bin\javaws.exe "" C \ Windows\system32\javaws.exe "Set java_path=c:\programdata\oracle\java\javapathdel/f"%JAVA_PATH%\java.exe "Mklink" %java_path%\java.exe "%java_home%\bin\java.exe" del/f "%java_path%\javaw.exe" Mklink "%java_path%\javaw.exe" "%JAVA _home%\bin\javaw.exe "del/f"%java_path%\javaws.exe "Mklink"%java_path%\javaws.exe ""%java_home%\bin\javaws.exe " Echo has switched to JDK%java_version%goto Exit:exit

  

Switch Java JDK version scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.