aspose file tools*
The moose likes Java in General and the fly likes java -version how to set from 1.5 to 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java -version how to set from 1.5 to 1.4" Watch "java -version how to set from 1.5 to 1.4" New topic
Author

java -version how to set from 1.5 to 1.4

Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Hello,


I have to jdk installed 1.4.2_09 and 1.5.0_05. I set up all of my environment variables to to the 1.4 version because I want to use this one, but it keeps showing me the 1.5 version when I run 'java -version'.

I would like my system not to see the 1.5 version, but also I don't want to uninstall it.

With all environment variables set to 1.4, where can I actually make the settings so 'java -version' let's me know I'm using 1.4? Is it registry entries?

I'm doing some testing involving Tomcat, Maven, and MySql. (Tomcat is set to use 1.4 using the compatibility patch.

Appriciate any help,


Jimmy Die
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
perhaps if you modify your path variable to point to the right %JAVA_HOME%\bin then it would display the right version? Also, maybe two versions are registered in your path variable that triggers this conflict...


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
That is a good idea,

But all of my environment variables are set to my 1.4.

So I have removed all references to 1.5 in all of my environment variables including path, JAVA_HOME everything.

Wagner Danda Da Silva Filho
Ranch Hand

Joined: Mar 21, 2003
Posts: 80
I gess you are using Windows, right? Where is you executing the "java -version" command? In the "cmd.exe" or "command.exe"? Type "set" in the command line and look at the "PATH" variable, check if you jdk1.4 bin path is there.


SCJP, SCWCD
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
I am using Windows XP Professional.


Yes my path is the C:\j2sdk1.4.2_09\bin and no other java paths are set.

Thats a good test, but do you have another suggestion?
[ October 20, 2005: Message edited by: Jimmy Die ]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Did you restart the computer after changing the environment variables? Sometimes this is necessary in Windows.

But...why do you want to use Java 1.4? The Java 1.5 compiler can compile to 1.4 byte code if you use the -target 1.4 command line option. Also, Java 1.5 can run 1.4 byte code. It seems to me that you don't need to have Java 1.4 installed for most situations.

Layne


Java API Documentation
The Java Tutorial
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Yes I did restarts, Several .

I'm running software platform called Sakai (for higher education). It runs on tomcat.

Maven is used to build and re-build the platform from src. The platform is not ready for 1.5 (believe me I've tried long and hard to make it work) and I must use Maven to recompile, for this I need to have the 1.4 version set and ready for Maven to use it to perform the build...

Normally I would just do as you suggested, but Maven is a little tempermental.


I will say that I've uninstalled the jre1.5 and kept the sdk1.5. When doing this I get the version that I am looking for, but I was hoping not to have to uninstall the jre1.5 to accomplish this.
Ray Horn
Ranch Hand

Joined: Oct 20, 2005
Posts: 39
seems your already have a solution; but I had same issue
on old NT box; found a 'java.exe' in the c:\winnt\system32
directory which always ran the 1.5.0_04 JRE. Could have
one installed in XP system directory.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
On Win 98 the java 1.5 installation copies the java.exe and javaw.exe files to the C:\Windows folder. It also makes some changes in the registry.

To move from 1.4 to 1.5 and back:
I copy the relevant java.exe and javaw.exe files from the java installations bin\ folder to the Windows folder.

In the registry entry:
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.5"

I change currentversion from 1.4 to 1.5 or vv.
Jimmy Die
Ranch Hand

Joined: Nov 20, 2003
Posts: 97
Some good ideas,

Thanks much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java -version how to set from 1.5 to 1.4