• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Diffetent Java compiler in same machine

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79401
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic