• 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

JRE VERSION

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have installed jdk 1.6 and jre 6. I had jdk 1.4 installed previously. When I run javac -version in cmd prompt , I get jdk version as 1.6.
But when i run java -version on cmd , i get jre version as 1.4. How can make it to read jre 6??
Note:- I am new to environment variables, so please explain in detail.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you probably need to look at your path. This is a list of directories that the operating system uses to find what program you want. Mine looks like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Lenovo;C:\Program Files\Lenovo\Client Security Solution;c:
am Files\Altiris\Software Virtualization Agent\;C:\Novell\GroupWise;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\strawberry\c\bin;C:\stra
\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files\Java\jdk1.6.0_23\bin;C:/Python27;c:\sqlite;c:\unixtools

So, when you type "java" on the command line, the OS says "hmm...do I know what this is? no. Lemme try and figure it out.".

It check the first directory in the PATH, looking (in this case) for something called "java.exe". If it doesn't find it in the "C:\WINDOWS\system32", it next looks in the "C:\WINDOWS" directory. It keeps going until it either a) finds the java.exe in a directory, or b) runs out of directories to try.

Your PATH probably has several 'java' type entries. When you do "javac", it looks for the "javac.exe" in that list. For whatever reason, you have a java.exe in a path entry where you don't have a javac.exe (or vice versa).

You can probably shuffle the order of the entries to get the one you need, or better, take out the entires you don't need any more.

CAUTION: i'd make a backup of what your PATH is before editing it, just in case you screw something up.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

In addition to what Fred said, have a look at this FAQ.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic