wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Diffetent Java compiler in same machine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Diffetent Java compiler in same machine" Watch "Diffetent Java compiler in same machine" New topic
Author

Diffetent Java compiler in same machine

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 169
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

Joined: Jun 06, 2007
Posts: 2716
    
    6

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


SCJP, SCWCD.
|Asking Good Questions|
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38508
    
  23
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

Joined: Jun 06, 2007
Posts: 2716
    
    6

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

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Diffetent Java compiler in same machine