File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Newer version of java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Newer version of java" Watch "Newer version of java" New topic
Author

Newer version of java

jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
I have java j2re1.4.12 installed on my desktop. I have installed newer version jre6. How can I check which version is in effect now ?
In previous version , it says j2re while in new version it says jre. Why did 2 disappear ?
If older version is in effect , how can I replace it with new version ?
In the "PATH" variable, path shown is c:\WINDOWS\system32" , where java.exe file is kept. At the same time , there is java.exe file in the path "C:\Program Files\Java\j2re1.4.2_04\bin". When file is in two places, the one in "PATH" variable will be used for executing class files ?
How can I check, what version of java.exe file is in use ? I clicked on the properties of java.exe specifies in "PATH" variable and it shows "6.0.110.3" under version tab, does it mean that version 6 is in use instead of version 4 ? If yes, then how did version 4 got replaced with version 6 ?

java.exe and javac.exe are two different files, right ?
We need javac.exe file for compiling source code. javac.exe file is nowhere in the path "C:\WINDOWS\system32" and I dont see this file anywhere in thye bin folder. So how can javac.exe be used ?

thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18821
    
  40

How can I check, what version of java.exe file is in use ? I clicked on the properties of java.exe specifies in "PATH" variable and it shows "6.0.110.3" under version tab, does it mean that version 6 is in use instead of version 4 ? If yes, then how did version 4 got replaced with version 6 ?


The easiest way to tell which java is specified by the PATH, is from the command line, run ... java -version

java.exe and javac.exe are two different files, right ?
We need javac.exe file for compiling source code. javac.exe file is nowhere in the path "C:\WINDOWS\system32" and I dont see this file anywhere in thye bin folder. So how can javac.exe be used ?


Javac is the compiler, and it will be installed when you install the JDK. Since you installed the JRE (Java runtime environment), you don't have the Java compiler installed.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
jignesh soni
Ranch Hand

Joined: Dec 10, 2007
Posts: 150
thanks for the reply.
Can you please answer following questions

1) If I want to replace older version with newer version, what shall I do ? change the value in "PATH" variable ?

2) If I logon to a machine where JDK is already installed, where can I check javac ?

4) javac compiles source code and java executes class files. Value in the
"PATH" variable compiles source code or executes class file ? If it executes class files then what value do I set in the "CLASSPATH" variable ?
Can we use "PATH" variable and "CLASSPATH" variable interchangeably ? Can I create my custom environment variables and set the java.exe and javac.exe files in there or does it have to be in "PATH" and "CLASSPATH" variables only ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

Originally posted by jignesh soni:
In previous version , it says j2re while in new version it says jre. Why did 2 disappear ?

Because Java 1.4 was the last version of Java to be labeled as Java 2. Java 1.5 is Java 5.0, Java 1.6 is Java 6. There is also no more J2SE but just Java SE.
If older version is in effect , how can I replace it with new version ?

Normally, when you install Java 1.4 first and then Java 6, you don't need to do anything.

Should you still want to change it, this explains how:
The java.exe and javaw.exe in the system32 folder look in the registry.
If you open it (it's called regedit.exe; be very careful!), and open the path to HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment, on the right there is a key-value pair with the key being called "CurrentVersion". This specifies the sub tree on the left to use. My PC says "1.6" so it looks in the "1.6" sub tree and sees my Java home is "C:\Program Files\Java\jre6".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newer version of java