When I change the Java home version then my jdk version gets changed if I use the Environment Variables from System Properties windows GUI.
For example if I am using JDK1.5 and if I change the JAVA_HOME version to JDK1.6 then the java version changes to the corresponding 1.6 version.
So in my application I created a combo box which displays the different java version and when the user selects the version of his choice and click the change button then my application has to change the java version to the corresponding version.
I tried the code which was mentioned in my first post. This makes change to the registry variable and I can see the corresponding changes in the environment variable settings but still I see previous java version used not the changed one.