Skip navigation

HT5493: About Java for OS X 2012-006

Learn about About Java for OS X 2012-006

HT5493 Java Preferences app missing after java update

37711 Views 44 Replies Latest reply: Jun 29, 2013 12:45 AM by rhimac RSS
  • jklap Calculating status...

    For those of us using the command line, you can use java_home to "pick" the JDK even though the Java Preferences app has been removed and without mucking with CurrentJDK (which is what I used to do until I found this trick). This can be used to set your JAVA_HOME such as adding the following to your ~/.bash_profile:

     

    export JAVA_HOME=`/usr/libexec/java_home`

     

    Assuming whatever you do uses JAVA_HOME (such as maven), your golden

     

    By default, java_home returns the 'default', which is Java 7:

     

    /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home

     

    You can see all the possible options using -V:

     

    > /usr/libexec/java_home -V

     

    Matching Java Virtual Machines (5):

        1.7.0_09, x86_64:          "Java SE 7"          /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home

        1.7.0_07, x86_64:          "Java SE 7"          /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home

        1.7.0_06, x86_64:          "Java SE 7"          /Library/Java/JavaVirtualMachines/jdk1.7.0_06.jdk/Contents/Home

        1.6.0_37-b06-434, x86_64:          "Java SE 6"          /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

        1.6.0_37-b06-434, i386:          "Java SE 6"          /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

     

     

    Once you know what you have and which you want, you can specify:

     

    /usr/libexec/java_home -d64 -v 1.6.0_37

     

    Or to choose the latest installed 1.6.X:

     

    /usr/libexec/java_home -d64 -v 1.6*

     

    Check the man page for java_home for additional details

  • ITFC Help Calculating status...
    Currently Being Moderated
    Oct 25, 2012 2:19 AM (in response to jklap)

    This is helping me to get where I need to be but Im stuck at one pivotal place.

     

    Once the app is gone and 7 removed can you just copy the preferences app back from another mac I need to be able to prioritise the architectures like you were able to with the preferences app.

     

     

    Using all available info so far I have both javatester and java -version reporting the same thing but my app still doesnt work and until the dev company resolve to getting it to work in 7 I really need to roll back.

     

    By doing your suggestion I get

     

    > /usr/libexec/java_home -V

     

    Matching Java Virtual Machines (2):

           1.6.0_37-b06-434, x86_64:          "Java SE 6"          /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

        1.6.0_37-b06-434, i386:          "Java SE 6"          /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

     

    My app still doesnt work and I'm loathed to restore the mac unless it is the ONLY way to get it back.  I wonder if I need the i386 version as the top version used?

     

    Hope that makes sense.

  • MadMacs0 Level 4 Level 4 (3,320 points)

    ITFC Help wrote:

     

    Once the app is gone and 7 removed can you just copy the preferences app back from another mac I need to be able to prioritise the architectures like you were able to with the preferences app.

    A few users have claimed that they were able to do this, but about an equal number said it did not work after they copied it. None of the authoritative writeups on this subject have recommended it. Apparently the reason it won't allow one to switch between 6 and 7 is that 7 is stored in a different place, so Java Prefs doesn't find it, but that's not your situation, so it might work for you.

    My app still doesnt work and I'm loathed to restore the mac unless it is the ONLY way to get it back.  I wonder if I need the i386 version as the top version used?

    You haven't told us what that app is, but at least one developer found their Gradebook app did not work with 1.6.0_37 either and has issued instructions for a work-around.

     

    If your app is running in 32-bit mode, then perhaps you do need to move i386 to the top, but I would think the system would be able to properly sort that out as long as they are both active. You should be able to select it with:

    /usr/libexec/java_home -d32 -v 1.6.0_37

  • ITFC Help Level 1 Level 1 (0 points)

    EDIT: Hah Im too slow, thanks

     

    I assume it is to use /usr/libexec/java_home -d32 -v 1.6*

     

    Ive probably trashed all the Java with trying all these things.  Is there no way to start from scratch without 'starting from scratch'

     

    The app is a bespoke java video player.  Im typically a windows support chap but as far as anybody else is concerned I deal with anything with electricity so I must now what Im doing.

  • MadMacs0 Level 4 Level 4 (3,320 points)

    ITFC Help wrote:

     

    Is there no way to start from scratch without 'starting from scratch'

    Somebody posted instructions for OS X 10.7 Lion users that would return them to 1.6.0_29, by not running software update to get to _37.  It looks like there is a way for Snow Leopard 10.6 users to do that, also.

     

    I strongly recommend against it because it re-opens the CVE-2011-3544 vulnerability to Flashback and other minor malware.

  • ITFC Help Level 1 Level 1 (0 points)

    OK I'm totally baffled.

     

    All of a sudden

    javatester shows 1.7.0_06

    java -version shows 1.6.0_35

    java_home -V still only shows the two? 1.6.0_35?

     

    Now it's back to missing plugin?

  • MadMacs0 Level 4 Level 4 (3,320 points)

    ITFC Help wrote:

     

    javatester shows 1.7.0_06

    java -version shows 1.6.0_35

    java_home -V still only shows the two? 1.6.0_35?

    Before you reported that you had 1.6.0_37, how did it get back to _35?

     

    I suspect javatester knows the new place to look for Java 7. When you installed it before, was it the JRE or JDK version? The former just installs a new plugin while the latter installs what you need to run Java 7 outside of your browser. java_home probably only knows where Java 6 is right now.

    Now it's back to missing plugin?

    Do you care about the plugin? It isn't used by your desktop app, only your web browsers. You haven't said and your profile doesn't seem to reveal what OS X you are running, but with no plugin then I suspect it's Snow Leopard. If Lion or ML and you want to revert the plugin, as well, then then Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality

  • d1212 Calculating status...

    when i type the command java home into the terminal i get the following returned:

     

    Exception in thread "main" java.lang.NoClassDefFoundError: home

    Caused by: java.lang.ClassNotFoundException: home

        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

     

    any ideas what this means?

     

    thanks

  • Gerry Panganiban Calculating status...
    Currently Being Moderated
    Nov 2, 2012 12:23 PM (in response to d1212)

    It should be java_home (notice the under_score)

  • d1212 Level 1 Level 1 (0 points)

    when i type java_home it returns:

     

    -bash: java_home: command not found

     

    I am using lion btw, would this have an influence?

  • Gerry Panganiban Level 1 Level 1 (15 points)
    Currently Being Moderated
    Nov 2, 2012 12:36 PM (in response to d1212)

    Ah. I forgot that the java_home tool isn't in standard unix shell $PATH. It should be:

     

    /usr/libexec/java_home

     

    It will return the location of the current version of Java. To get the older version, use:

     

    /usr/libexec/java_home -v JAVA_VERSION

     

    Where JAVA_VERSION is whatever version you want. (If you don't have that version installed, it will let you know).

  • Gerry Panganiban Level 1 Level 1 (15 points)
    Currently Being Moderated
    Nov 2, 2012 12:41 PM (in response to jklap)

    Thanks!! This totally solved my problem.

     

    For reasons I too complicated to describe here, java_home on my mac was deleted and didn't get restored when I re-installed Java.

     

    After a fresh-install of Mountain Lion AND Java, java_home worked just fine.

     

    For the command-line, I simply added:

     

    export JAVA_HOME=`/usr/libexec/java_home -v 1.6`

     

    in my .bash_profile script.

     

    For java GUI apps (eg: Eclipse), they just worked with no issues.

  • luisgon Calculating status...

    At least they provided a way to still use the Apple-provided Java plugin like MadMacs0 said...

     

    But if they removed the Java preferences, how can I, for example, add Runtime Parameters? Is there any way to do that?

  • frafa Calculating status...

    I first installed ORACLE's 1.7 and then also installed apple's 1.6 through update, as many Java-based Mac-Apps need 1.6. But you can't make 1.6 the default through the NEW JAVA preference pane in System Prerferences, because it doesn't see 1.6. So your next choice would be Java Preferences.app in /Applications/Utilities, but this one's gone. I had to reinstall it.

     

    The 10.8 dmg has it under /Packages/JavaEssentials.pkg

     

    I googled around and found a link:

     

    http://appleupdate.centenary.usyd.edu.au/appleupdates/content/downloads/11/30/04 1-4540/6JfG7McpmBmS2nbCWvJXX9GQmYhYQ8dWQJ/JavaEssentials.pkg

     

    After the install you find your old Java Preferences.app in its old place, allowing you to switch between all installed JAVA versions and allowing your Browsers to use applets again.

     

    Yet another barrier for JAVA broken down.

  • rhimac Level 1 Level 1 (0 points)
    Currently Being Moderated
    Jun 29, 2013 12:45 AM (in response to frafa)

    I have installed Oracle's latest java JDK 1.7  as default here on 10.8.4 for security reasons. But I also wanted to be able to continue to use Apple's java 1.6 with some apllications that depend on it. The fixed upade 2013-004 (Build ...M4509) works well again.

    Switching the default java would be a possibility, but I seems rather cumbersome to switch back and forth each time.

    I found a solution that allows me to have java 1.7 as default and switch to 1.6 in conjunction with the launch of a specific app. It involves exporting java as described by Gerry above and launching the app via AppleScript.

    I made an AppleScript.app rather than resorting to the terminal each time.

     

    The following is an example which works for me in this case with the program JGR.app (a nice java GUI for R and Deducer).

     

    Open AppleScriptEditor

    type in the following 3 lines

     

    do shell script "JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

    export JAVA_HOME

    /Applications/JGR.app/Contents/MacOS/JGR"

     

    save the app

              by selecting  "Application" from the drop down menu and name the app as you like.

     

    Double clicking the newly created app will invoke the java version specified in the script and start the program. Double clicking the progrm itself will still attempt to start it under the default java environment, if that works.

     

    The script assumes that all components reside in their typical location on the Mac. Otherwise the path needs to changed accordingly. It also requires the java program to call java via java_home.

     

    It is not a switch, but a convenient way to use different java versions side by side without a need for repeatedly switching the default.

1 2 3 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.