Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java version.

 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends ,

I was having java 1.4 installed on my machine. Now , recently i upgraded to 1.5. However when i goto command prompt and type this :

> java -version

it still says 1.4 releated things.

Can someone let me know how would the new 1.5 come in effect. I need to use new 1.5 features like static imports , enums etc.

Thanks in Advance.

Yogendra N Joshi.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't feel that it should be in the Advanced forum
Please check your PATH variable. It probably contains a directory pointing to version 1.4 of your compiler.
 
Mike Guze
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, You have to put the absolute path of the bin directory (in my case "C:\Archivos de programa\Java\jdk1.5.0\bin") in an environment varible called "path"; In windows have to check the system32 directory, if there are java.exe and javac.exe you have to move out them.
 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike / Satou ,

I tried doing as told by you... But it didnt work out.

I moved java.exe , javaw.exe , javaws.exe from system32 folder and added an entry for PATH variable as C:\Program Files\Java\jdk1.5\bin

and then i went to cmd again and tried. Still its 1.4

Please help out.

Thanks
Yogendra
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15436
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly does your PATH environment variable contain now?
Did you restart the computer after changing the PATH?
 
Bill Cruise
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You most likely need to put the new path pointing to the Java 1.5 JDK at the front of your PATH variable. I've seen a similar problem before when another program I've installed has modified my PATH for me and over-ridden the JDK that I had specified.

In short, your system will use the first JDK it finds in your PATH. So if you have

PATH = .;C:\Program Files\Java\jdk1.4.2\bin;C:\Program Files\Java\jdk1.5\bin

you system will use the 1.4.2 JDK.

If you find that this is the case, just remove the older one, or rearrange them so that 1.5 comes first.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic