• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Diffetent Java compiler in same machine

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected Sirs,

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.

Thanks in advance.
Francis
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


Hope this helps
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell, sorry if I suggested something wrong,
but it's the last thing one can do to get the task done.
Hope you wont misunderstand.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second JVM / compiler will need to be called with the full path:


Alternatively, you can change the path in the command box as suggested by Campbell by using the following:

Once you close the command box this version of PATH is discarded.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic