PDA

View Full Version : changing java version




sms
May 8, 2005, 04:29 PM
I just updated to 5.0 and changed the java version from the java preferences as instructed in the installation instructions. However, from the terminal if I type java -version it shows that the 1.4 is still the default. Can someone tell me how to set 5.0 as the default from the terminal.



DXoverDY
May 8, 2005, 05:25 PM
I just updated to 5.0 and changed the java version from the java preferences as instructed in the installation instructions. However, from the terminal if I type java -version it shows that the 1.4 is still the default. Can someone tell me how to set 5.0 as the default from the terminal.

You will also have to restart terminal.app i believe to make the changes effective for that shell.. double check your directions and try it again, you probably just misread and didn't do something right.

as a side note, anyone who is updating may want to be warned that it does break some applications that ran fine with 1.4... so be careful and if you find an app doesn't work anymore, that would be why.

sms
May 8, 2005, 05:33 PM
You will also have to restart terminal.app i believe to make the changes effective for that shell.. double check your directions and try it again, you probably just misread and didn't do something right.

as a side note, anyone who is updating may want to be warned that it does break some applications that ran fine with 1.4... so be careful and if you find an app doesn't work anymore, that would be why.

I restarted terminal.app, restarted the machine, kicked it a couple times and still no go. Any idea what the command is to change the java version from the command line, been looking everywhere and I can't seem to find it.

Pronil
Nov 16, 2005, 03:38 AM
Hi Mate,

I have done it very manually. Actually, as you install higher version of java, the current jdk directory points to it. At the same time the older versions are not deleted and an archive are maintained. In case of JDK 1.5 this does not happen. The information about the java is stored in Infor.plist under the resource directory.
In order to change java to any new or restore to previous version this following step works
Go to : /System/Library/Frameworks/JavaVM.framework/Versions
Copy all the files and directories from the particular version directory which you want to change to and paste them to the folder CurrentJDK.
e.g. to change to 1.5 I will copy all the folders from /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ to /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/

To perform any action on system folders you need to have system root login.
Please be careful in changing any system files with this login as the login has full right to curropt the OS too.

caveman_uk
Nov 16, 2005, 04:25 AM
Can't you just symlink them rather than copying?

Nermal
Nov 16, 2005, 04:30 AM
Just use the Java Preferences app. It's a bit tricky to find, so the easiest way is to use Spotlight.

If you want to open it manually, it's in /Applications/Utilities/Java/J2SE 5.0/Java Preferences.

Edit: It seems that this doesn't change everything, as "java -version" is still reporting 1.4.2 for me.

devman
Nov 16, 2005, 08:53 AM
http://developer.apple.com/releasenotes/Java/Java50Release3RN/index.html

The Using J2SE section and Outstanding Issues section.

Pronil
Nov 22, 2005, 04:27 AM
Creating symlink or alias did not helped, only copying did. CurrentJDK direcotry is actually an alias of 1.4.2 directory. Now, where this information is stored, I was unable to find out, so the only thing for time being we can do is use 1.4.2 or CureentJDK directory act as 1.5 that can only be done by copying all the installed file of 1.5 to the CurrentJDK folder or virtually in 1.4.2 folder. Thus, prior to this preserve the content of 1.4.2 in some other folder, this will help u to revert to 1.4.2(or previous version) any time.