how to set Java 7u9 to be the default JVM on mac osx 10.7.5 (original) (raw)

Rick Hillegas rick.hillegas at oracle.com
Mon Nov 5 08:51:33 PST 2012


I am trying to use Java 7u9 as the default JVM on my macbook pro (running osx 10.7.5). I haven't figured out how to configure my machine so that a Java 7 app will come up when I click on its icon. I would appreciate your advice about what I need to do to configure my machine.

When I click on the app, I get a popup window telling me that the system couldn't find a 1.7 version of Java. The popup window has a button labelled "Open Java Preferences", but when I click on that button, xyzzy, nothing happens. However, the app does come up if I click on its jar file after navigating to it via Finder's "Show Package Contents" option.

This is how I attempted to configure my machine to use 7u9 as the default JVM:

A) I installed Java 7u9 using the dmg obtained from http://www.oracle.com/technetwork/java/javase/downloads/jre7u9-downloads-1859586.html. This put the 7u9 JDK in /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk.

Now I wanted to make Java 7 the default VM on my mac. I googled around and came across the suggestion that I should drag Java 7 to the top of the list managed by the Java Preferences app. However, this app does not exist on my version of mac osx (10.7.5). So I did the following:

B) I created a softlink from /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK to /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents

According to the following webpage, versions of osx like mine are supposed to default to the highest version of Java which the os can find: http://reviews.cnet.com/8301-13727_7-57533880-263/java-preferences-missing-after-latest-os-x-java-update/. But I clearly haven't figured out how to let the os know what that version is.

Thanks in advance for your advice, -Rick

Here are some more details on the experiments I ran:

----------- GOOD BEHAVIOR UNDER JAVA 6 ---------------

I built my app with these settings:

i) Used the Java 7 javac ii) Set javac source and target level to "1.6". iii) Set the JVMVersion in the app's Info.plist to "1.6+".

When I compiled, I got the following warning but the app built:

"warning: [options] bootstrap class path not set in conjunction with -source 1.6"

In this situation:

I) The app comes up if I click on it in a Finder window or on its icon in the dock.

II) The app also comes up if I double click on the app's jar file after navigating to it via Finder's "Show Package Contents" option.

----------- PUZZLING BEHAVIOR UNDER JAVA 7 ---------------

I then re-built my app with these settings:

i') Used the Java 7 javac ii') Set javac source and target level to "1.7". iii') Set the JVMVersion in the app's Info.plist to "1.7+".

This compiled cleanly without warnings.

In this situation:

I') The app does NOT come up if I click on it in a Finder window or on its icon in the dock. Instead, I get the popup window described above.

II') However, the app DOES come up if I double click on the app's jar file after navigating to it via Finder's "Show Package Contents" option.



More information about the macosx-port-dev mailing list