On windows, I installed both j2sdk1.4 and jdk1.5 (1.4 for working, 1.5 for personal) environmental variables are: PATH as 1.4/bin, JAVA_HOME is where 1.4 is. so after these, I thought 1.4 is the version of java i am using now, but when i try 'java -version' on command line, 1.5 shows up. If I disable PATH, 'javac' (compile) won't work, means i am still using 1.4 to compile. however, 'java' works fine. I guess there's something i should setup as well as PATH and JAVA_HOME. maybe CLASSPATH? I wonder. Thanks in advance.
Path should be the main thing you need to get going. I have a couple BAT files I use to set JDK paths. By default my command windows don't have a path to a JDK or JRE so I have to run one or the other to get running. Here's one for Java 5:
Hmm, I forgot that sets JAVA_HOME, too. Maybe I needed that for ANT. Once you have the JDK path going, see if this tutorial helps with classpath and all that. Follow the link to the Sun "setting the classpath" page, too.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Jul 21, 2002
I found where the problem is.
I have JRE1.5 (not JDK) installed under a different folder than JDK1.5. that's the reason why after PATH is setup to 1.4, 'java -version' still says it's 1.5.
after uninstall JRE, 'java -version' gave what specified in PATH env.
subject: which environment variable decide 'java -version'