Java on the Mac, update

84 views
Skip to first unread message

Jean-Christophe Helary

unread,
Apr 19, 2013, 9:47:34 AM4/19/13
to mac-for-translators@googlegroups.com Translators
Alex, the main OmegaT developer told the dev list that Java 1.8 seemed to fix a number of Java issues on the Mac. I've tried it and indeed, some problems seem to have gone away.

You may remember an old post of mine where I wrote about where all the different versions of Java where hidden on your Mac ? Adding a Java 1.8 will only add to the mess, but if you want to do some experiments here is what you need to now.

1) Once you install a new version of Java it can't be trivially removed
2) Installing Java 1.8 will make it the default Java on your system
3) If you want to revert to a previous version of Java as the default, you'll need to use the command line
4) If you are not familiar with the command line, become familiar with it before you try anything

Ok, so let's start now.

All the versions of Java installed on you system are hidden here:

/Library/Java/JavaVirtualMachines/

On my machine, I have:

1.6.0_37-b06-434.jdk
1.7.0.jdk
1.7.0u4.jdk
JDK 1.7.0 Developer Preview.jdk
jdk1.7.0_07.jdk
jdk1.7.0_08.jdk
jdk1.7.0_21.jdk ← added today
jdk1.8.0.jdk ← added today

With the new way Mountain Lion manages Java (no Java Preferences application anymore) it is not possible to set a priority in the various JVMs anymore with a GUI application.

So, in my case, when I now run "java -version", I see that I run Java 1.8, which is linked to:
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java

Which means that the system has put the highest version of Java in that "A" folder from which it links all the commands found in /usr/bin.

Problem is, once you've installed Java 1.8, it is stuck in A and you can't easily remove it.

There are 2 ways to solve the problem.

1) If you use the command line to launch your application , you can always explicitly specify the path to the java command you want to use. For ex, you can launch OmegaT with Java 1.6 from the command line this way:

$ /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/bin/java ~/jchelary/OmegaT/application/current_svn/omegat/trunk/dist/OmegaT.jar

But we agree that is it not always practical, especially if we just want to double-click on OmegaT's icon to have it start, because then, the system defaults launch Java 1.8...

But it is possible to tell the system which default Java version to use. Java uses an environment variable called JAVA_HOME where it sets the path of the default JVM.

Everything you need to know is here:

http://stackoverflow.com/questions/13594864/how-to-revert-to-java-1-6-on-mac-os-x-10-7-5

The information refers to Java 1.6 and 1.7 but the idea is exactly the same for all the versions you have on your system.

Basically, the idea is that instead of the old "Java Preferences" application that used to let you set the Java version you wanted to use, you use the command line to set the value, either temporarily or (semi) permanently by exporting the desired value of JAVA_HOME in .bash_profile.

So, now you can install Java 1.8, knowing that you won't be able to remove it *but* you'll be able to reset the JAVA_HOME environment variable so that the system forgets about Java 1.8 and uses your preferred Java version instead.

Java 1.8 download:
http://jdk8.java.net/download.html

Java 1.8 build:
https://wiki.openjdk.java.net/display/MacOSXPort/Main

Et voilà !


Jean-Christophe Helary
----------------------------------------
fun: http://mac4translators.blogspot.com
work: http://www.doublet.jp (ja/en > fr)
tweets: http://twitter.com/brandelune

Jean-Christophe Helary

unread,
Jan 5, 2014, 6:38:21 AM1/5/14
to mac-for-translators@googlegroups.com Translators
As a followup, you can find the most recent versions of Java 7 and 8 for the Mac on the following pages:

Java SE Development Kit 7 Downloads (currently Java SE Development Kit 7u45)
http://www.oracle.com/technetwork/jp/java/javase/downloads/jdk7-downloads-1880260.html

JDK™ 8 Early Access Releases (currently 8 Build b121)
http://jdk8.java.net/download.html

If you use OmegaT, the recent Okapi plugin requires Java 7

Happy translation on the Mac year to you all !

Jean-Christophe
Reply all
Reply to author
Forward
0 new messages