I have using windows xp. In "C" drive I have installed java 1.4 ( jdk and jre) and in in "F" drive I have installed java 1.5 (jdk and jre). I am using java 1.4 for official use and java 1.5 for personal use. How can I use java 1.5 for compiling and running a program. 1.4 is setting through Eclipse. And I am execute a command java -version which produce "java version 1.5.0_06 ". But I cant compile a program using java 1.5 syntax.
Check your path. But if you are able to execute java command at any other location apart from the installation directory, then I think your path is set properly to version properly but crosscheck once.
You can also add the 1.5 version to Eclipse or compile your programs in the 1.5 bin directory.
Originally posted by Amit Ghorpade: You can . . . compile your programs in the 1.5 bin directory.
No, don't do that. Leave the bin directory for what is installed with Java and put your programs into another directory.
If you want to use JDK1.5 (which you ought to call Java 5) make sure the path to it is the first Java path in your path variables. Remember you have to open a new command prompt for the path to be valid.
There is a way you can set the path for the lifetime of a particular command prompt window, but I can't remember how to do it. See the last post on this thread, but remember: you want the Java installation you are using first in the path.