Note that the CLASSPATH setting will have no effect on which version of the runtime is used.
What you want to set is your PATH environment variable.
It can be as simple as set PATH=C:\j2sdk1.4.2\bin;%PATH% for 1.4 or you might set it permanently in the Windows dialog.
To
test which version JVM will be started, use:
java -version
To test which version compiler will be started, use:
javac -J-version
To determine the version at runtime, use:
String version = System.getProperty("java.version");