Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: About the Java SE 5.0 Release 3 update System 10.4
Tiger only hintYesterday, Apple released Java 2 Platform Standard Edition (J2SE) 5.0 Release 3. It's in Software Update, and you can read more about it (and find a download link) on Apple's About the Java 2 ... Release page. If you're like me, you might be slightly confused by the version number -- it seemingly jumps the Java version from 1.4.2 to 5.0, which is quite the move. In addition, unlike prior Java updates, this one doens't replace the 1.4.2 version; it's installed right next to it.

To help clarify the situation, macosxhints forum moderator hayne has put together a nice write-up that explains what's up with the version number, why two versions are installed, and how to put the new version to use.

Here's a summary of the topics he covers:
  • The update (which is only available on Tiger) installs Java 5 (which is also known as Java 1.5)
  • The default version of Java remains as Java 1.4 even after the update. Thus it should be quite safe to install this update since by default it makes no change to the Java environment.
  • You can change the version of Java to be used by certain Java programs/applets by using the new Java Preferences app, which is found in the Java/J2SE 5.0 folder, within the /Applications/Utilities folder.
  • Contrary to what you may have read elsewhere, you should not modify anything (e.g. symbolic links) in the /System area of OS X to change the default to be Java 5.
Read his writeup for the details behind this somewhat-complex (to me, anyway!) Java update.
    •    
  • Currently 2.75 / 5
  You rated: 1 / 5 (4 votes cast)
 
[19,305 views]  

10.4: About the Java SE 5.0 Release 3 update | 19 comments | Create New Account
Click here to return to the '10.4: About the Java SE 5.0 Release 3 update' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: About the Java SE 5.0 Release 3 update
Authored by: apenstaartje on Nov 16, '05 07:55:35AM

> Contrary to what you may have read elsewhere, you should not modify anything (e.g. symbolic links) in the /System area of OS X to change the default to be Java 5.

As far as I now, you still have to, at least when you run java applications other then just applets in the browser.
For me, I use Eclipse a lot, and I have to recreate the symbolic link to 1.5 for it to work correctly (I run plugins that require 1.5).



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: raider on Nov 16, '05 08:45:02AM

Ditto.

Contrary to what you may have read in *this hint* you *do* have to change the symbolic links in your Java Home to use Java 5 with lots of applications.

The Java preferences panel is only for applets.

In an OSX Java application you can specify the Java version in the "Info.plist" file in the application bundle, but for some reasons this is ignored by some applications.

They only way to get Java 1.5 to run applications with certainty, is to change the symlink in your Java Home.

However - that *does* change your default Java installation to 1.5....



[ Reply to This | # ]
Use 1.5 with eclipse without changing /System
Authored by: rselph on Nov 16, '05 10:33:50AM
There is a way to get around this for eclipse in particular.

In a terminal, do this:

cd /Applications/eclipse/Eclipse.app/Contents/MacOS
ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home jre

Eclipse searches in ./jre first for its jvm, so this will start it up in 1.5 always. You can also put this link in /Applications/eclipse if you want the command line invocation to work the same way.

[ Reply to This | # ]

Use 1.5 with eclipse without changing /System
Authored by: adrianm on Nov 16, '05 10:52:31AM
Another way is to edit the Eclipse.app/Contents/MacOS/eclipse.ini file to include:

-vm
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java
at the top, along with any other vm args you might want.

Strangely, these args also exist in the Info.plist, but are seemingly ignored. I guess the eclipse people didn't bother to read up on OSX app bundles :-)

[ Reply to This | # ]

Eclipse preferences
Authored by: hayne on Nov 16, '05 10:47:19AM

Are you saying that you tried changing Eclipse's own preferences so that it would use Java 1.5 (as recommended in the article) but it didn't work?



[ Reply to This | # ]
Eclipse preferences
Authored by: raider on Nov 16, '05 11:06:37AM

Yes. (See the other posts).

I don't see what the big fuss is anyway. Java 5 has been out for a very long time. It is backward compatible with 1.4, and is much faster and lighter....

I would say it is better to have 1.5 as the default, and only switch the apps that it breaks to use 1.4

I have yet to have an app break under 5 in Tiger , and I use many Java apps...



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: adriansutton on Nov 16, '05 01:48:43PM

You *never* need to modify the /System folder for Java. To get Eclipse to use Java 1.5, edit it's Info.plist inside the application bundle. The eclipse developers on the Apple java-dev list have outlined this process a number of times.

Better yet, don't run Eclipse on Java 1.5, it provides you with no advantages and it's generally more stable on Java 1.4 - which is why it specifically requests Java 1.4. You can still develop your applications within Eclipse using Java 1.5 and run your applications from within Eclipse under Java 1.5 by using Eclipse's preferences.

Do not modify the /System directory, it will cause you trouble when upgrading.



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: raider on Nov 29, '05 10:14:54AM

Eclipse is not the only Java application you know. There are lots of Java applications that do not honor OSXs method of chosing the JVM.

And you say that there is no advantage of using Eclipse under Java 1.5? Well, except faster startup times, and lower memory consumption. But hey - who needs those, right?

You say Eclipse is unstable under Java 1.5? Hmmm. Not a single problem for me yet. But I only use it every day all day long, so I might not have hit anything yet....

You say that changing things in the /System path will screw up updates? Like what? Can you be specific? Because as far as I have seen, since OSX 10.0.4 there have been lots of things that you are able to change under the /System path... Sure - you *can* cause problems, but this change with regards to Java will not cause problems. There are all sorts of things under /System that power users will work with. Preference Panes. Modem Scripts. Startup Items. Fonts. etc etc etc. Java is another one...

What is the hangup? The whole reason the thing USES A SYMLINK in the FIRST PLACE is to allow it to be changed.... That is the whole point.

You keep spouting doom and gloom - while those of us who use it every day have yet to run into any problems. Not that there will never be - but I have read the forums linked to, and I have played around with all the .plist files and whatnot - and the easiest, most consistant, and most effective way is to modify the Symlink. Period. Nothing else guarantees I will use Java 1.5 with all my applications.

So to people reading this - there are clearly two prevailing thoughts on this matter. I have not had a single problem changing the Symlink since the first betas of Java 1.5 came out. I did however have problems getting all sorts of applications to use Java 1.5 until I did change the Symlink.



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: davelentz on Nov 16, '05 08:20:16AM

And just to clarify things, having multiple "versions" of java installed is not a new thing. If you go into Terminal and type:

ls /System/Library/Frameworks/JavaVM.framework/Versions/

You will see that version 1.3.1 still exists, alongside 1.4.2 and 1.5.0.

A "stack" of java versions has been the case in OS X for a long time, the novelty here is that the "current" version does not point to the highest level version.

I suspect this is due to the bulk of the java apps not being ready for 1.5 yet -- at least so far as web usage goes, this would be the case. By sticking with 1.4 as the "default" level of java, we probably achieve the best degree of compatibility with java usage out in the real world.

Developers will, quite naturally, want to reset the "current" link to point to whatever version they wish to work with. It used to be that the way to do this was via setting of symbolic link(s) to point to the desired version of Java. With this 1.5 update, there is a preference utility in /Applications/Utilities/Java/J2SE 5.0/ that specifies which is the default version of java. Oddly enough, this utility only supports setting the nominal version of java to either 1.4.2 or 1.5.0 -- developers wanting to test using 1.3.1 will have to continue to manipulate symbolic links to make 1.3.1 the target.



[ Reply to This | # ]
not changing symbolic links
Authored by: hayne on Nov 16, '05 10:52:23AM
Developers will, quite naturally, want to reset the "current" link to point to whatever version they wish to work with
No - it is not necessary (and undesirable) to change the symbolic links. Please read my forums posting (referred to above) for details on how developers should handle this via changes to their shell environment and to their IDE preferences.

[ Reply to This | # ]
not changing symbolic links
Authored by: adriansutton on Nov 16, '05 01:50:08PM

And in fact, it has *never* been needed nor has it ever been a good idea to change the symlinks.



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: smkolins on Nov 16, '05 08:49:31AM

As mentioned <a href="http://www.theappleblog.com/2005/11/15/apple-silently-starts-sending-out-universal-binaries">here</a> this update is a universal binary installation. We are further down the road of dealing with larger file loads.

There is a thread elsewhere <a href="http://www.macosxhints.com/article.php?story=20050810112422666&query=ditto">on Mac OSX Hints</a> that discusses trimming out binaries for hardware not present.

Any considerations or evolution - seems something like delocalized could do trimming of hardware binary components.<p>

---
= - - -- - - - =
Steven
smkolins[at->]maccom
http://homepage.mac.com/smkolins
Possess a pure, kindly, and radiant heart!



[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: smkolins on Nov 16, '05 08:50:01AM
As mentioned here this update is a universal binary installation. We are further down the road of dealing with larger file loads. There is a thread elsewhere on Mac OSX Hints that discusses trimming out binaries for hardware not present. Any considerations or evolution - seems something like delocalized could do trimming of hardware binary components.

---
= - - -- - - - =
Steven
smkolins[at->]maccom
http://homepage.mac.com/smkolins
Possess a pure, kindly, and radiant heart!

[ Reply to This | # ]

10.4: About the Java SE 5.0 Release 3 update
Authored by: ploiku on Nov 16, '05 05:22:43PM

Installing this update, without any other changes, will allow you to run applications that require Java 1.5. It does not change what version of Java most applications or applets will use (typically 1.4.2).

If you use the Java Preferences application, there are 2 settings you can change. The first setting is for all Applets. Note that the default is for Applets to use 1.4.2.

The second setting is for bundled applications (.app), webstart applications, JAR files, and Class files. The order of the Java versions is the order that applications will look for Java versions... if they want to. For instance a particular application can request 1.4 only, 1.5 only, or "best version above 1.4" - this setting affects only the last scenario ("best version above..."). Note that (again) the default is to find 1.4.2 first.

Currently, there is no Apple supported way to change the command-line behavior of "java" (or the other command-line tools). The expectation is to use the full path to the specific commands you want.



[ Reply to This | # ]
command-line Java
Authored by: hayne on Nov 16, '05 05:41:21PM
Currently, there is no Apple supported way to change the command-line behavior of "java" (or the other command-line tools). The expectation is to use the full path to the specific commands you want.
Or just set up your PATH (and other env variables) to point to the version you want to use. This is what I describe in full in the forums article mentioned above.

[ Reply to This | # ]
10.4: About the Java SE 5.0 Release 3 update
Authored by: durin42 on Nov 16, '05 05:41:42PM

"Contrary to what you may have read elsewhere, you should not modify anything (e.g. symbolic links) in the /System area of OS X to change the default to be Java 5"
No. If you're doing ant-based development requiring you to compile using the javac for Java 1.5, you're gonna have to change some symlinks. Deal. It won't break much, if anything, and some things end up working better in my experience.

[Caveat: Maple breaks, but if you edit the Info.plist right it fixes everything. I'm assuming if you're deep enough to need this kind of functionality AND Maple you're smart enough to actually know how to do that and not be scared of it]



[ Reply to This | # ]
using javac
Authored by: hayne on Nov 16, '05 09:14:47PM
If you're doing ant-based development requiring you to compile using the javac for Java 1.5, you're gonna have to change some symlinks. Deal. It won't break much, if anything, and some things end up working better in my experience
It seems that you didn't read the forums posting that Rob referred to above. I explain there how to modify your shell environment to select whichever Java version you want.
There is no need to change any symlinks!

[ Reply to This | # ]
test application
Authored by: hayne on Nov 16, '05 08:46:23PM
I have edited the forums post to correct my earlier misstatement about what Java version is used for double-clicked JAR files.

And I attached a small test application (as a JAR file) that you can use to test what version is used when you make changes in the "Java Preferences" utility. All it does is put up a dialog stating which Java version is being used.

[ Reply to This | # ]

10.4: About the Java SE 5.0 Release 3 update
Authored by: quaeler on Nov 23, '05 12:49:00AM

part of the problem, it seems, is that apple's "Java Preferences" was not written for a development environment - just a deployment-only environment.

looking at /System/Library/Frameworks/JavaVM.framework/Versions/ we see that Current is correctly linked as defined by preferences set in the JavaPreferences.app.

HOWEVER, CurrentJDK's link is not changed. Combined this with what 'java' is linked to in my default path:
[...] root# which java
/usr/bin/java
[...] root# ls /usr/bin/java
lrwxr-xr-x 1 root wheel 57 Nov 13 21:59 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Commands/java

and of course:
lrwxr-xr-x 1 root wheel 28 Nov 13 21:59 Commands -> Versions/CurrentJDK/Commands

so regardless of what is set in JavaPreferences.app, command line java will reflect the jdk symbolic link.



[ Reply to This | # ]