Java Multiple Installations - Change Active Java Runtime With Minimal Effort

Posted at



This answer explains stuff with examples.   ME NO ₩OᴚDS MUCH ᴯᵁᵍᴬ ᴯᵁᵍᴬ 🍗

👉 Better Use the 8.3 directory-format. In fact No spaces, ever. 👍

JAVA_HOME - your JDK folder
C:\\Program Files\\Java\\jdk1.6.0_45 == C:\\PROGRA~1\\Java\\JDK16~1.0_4
C:\\Program Files\\Java\\jdk1.7.0_71 == C:\\PROGRA~1\\Java\\JDK17~1.0_7
C:\\Program Files\\Java\\jdk1.8.0_25 == C:\\PROGRA~1\\Java\\JDK18~1.0_2
C:\\Program Files\\Java\\jdk1.9.0 == C:\\PROGRA~1\\Java\\JDK19~1.0

JRE_HOME
C:\\Program Files\\Java\\jre6 == C:\\PROGRA~1\\Java\\jre6
C:\\Program Files\\Java\\jre7 == C:\\PROGRA~1\\Java\\jre7
C:\\Program Files\\Java\\jre1.8.0_25 == C:\\PROGRA~1\\Java\\JRE18~1.0_2
C:\\Program Files\\Java\\jre1.9.0 == C:\\PROGRA~1\\Java\\JRE19~1.0

Addition to PATH - best practice!
USE [WINDOWS]+[R] !!! ➩ C:\\Windows\\system32\\systempropertiesadvanced.exe
add ;C:\\ProgramData\\Oracle\\Java\\javapath; to the end of PATH (System Variables not User Variables).


  • click OK👆, explore to C:\\ProgramData\\Oracle\\Java\\ and rename javapath folder (from C:\\ProgramData\\Oracle\\Java\\javapath\\) to javapath_old.

  • create new folder named javapath.

  • start CMD and browse into (the now empty) C:\\ProgramData\\Oracle\\Java\\javapath\\.

  • run to create symbolic links:
    ln -s "C:\\Program Files\\Java\\jre7\\bin\\java.exe" java.exe
    ln -s "C:\\Program Files\\Java\\jre7\\bin\\javaw.exe" javaw.exe
    ln -s "C:\\Program Files\\Java\\jre7\\bin\\javaws.exe" javaws.exe

  • *done with PATH and *_HOME stuff (that's for kids 🎉), now **let's have fun with Windows Registry..*
    ➃ open up you prefered registry editor (Registry Workshop is the best), browse HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit notice all installed versions are shown as keys, double click CurrentVersion (REG_SZ value) and modify its data to your prefered SDK version, mine is 1.7 (For Android Studio)


➄ do the same for HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment (with CurrentVersion..)

➅ close down java-based programs such as eclipse or IntelliJ ,
Open up task-manager- processes tab, look for explorer.exe, cmd.exe and java(*something*).exe programs, right-click end them (no "End Process-Tree"!), click FileNew Task➩enter explorer.exe
.

🌟 The changes you've done above were applied successfully🌟


No need to reboot, No need to log-off/on again .



also published at stackoverflow