Thursday, 7 May 2015

JDK registry problem / issue solved in Windows 7

How to run a lower version of java when we have multiple jdk versions installed.


Please change the files in the following directory.

Step 1: Change directory to C:\ProgramData\Oracle\Java\javapath
Step2: Here you will find 3 exe files ( java.exe and javaw.exe and javaws.exe).  All three files are symbolic links to the actual distribution of java
Step3: Take a back up of these files in a directory of your choice.
Step4: delete all three files present in "C:\ProgramData\Oracle\Java\javapath"
Step5: Create new symbolic links for all 3 files with your distributed version.

In my case, I had installed jdk1.6, jdk1.7 and jdk1.8.  After lot of digging around I found that it is these 3 files which are actually getting referred.  So I created 3 symbolic links for the following files.\

The syntax is    mklink <linkname>  <actual exe name>

From under c:\ProgramData\Oracle\Java\javapath directory execute the following commands.

mklink java.exe c:\program Files(x86)\java\jdk1.6.0_24\bin\java.exe
mklink javaw.exe c:\program Files(x86)\java\jdk1.6.0_24\bin\javaw.exe
mklink javaws.exe c:\program Files(x86)\java\jdk1.6.0_24\bin\javaws.exe


Now go to any directory and type java -version, it will return only the version which you have linked ( in my case it is jdk1.6.0_24).

Thanks
Edwin.