5

Requirement

Java 6 for Android development on Mountain Lion.

Question

Is it possible? What can I do?

I've looked everywhere for a way to do this and am unable to find any solution.

Background

I recently installed Oracle's Java 7 for OS X on my Mac running Mountain Lion (10.8.2). I was happy with this until I started doing Android development, which throws errors relating to Java 7.

I downloaded Apple's Java for OS X Lion Update 1, but when I try to install it I get only this message before Installer closes:

A newer version of this package is already installed.

I followed Oracle's instructions (Mac FAQ), but they seem to not work for me. Afterwards if I do java -version it still says Java 7.

I even tried restarting my computer, to no avail.


Before I tried to reinstall Java 6, Apple's Java Preferences utility (described by Oracle) was present, but after trying all these things I am also without Java Preferences.

  • Yep, see my answer here – Ethan Lee Nov 23 '12 at 2:15
  • Hmmm, that didn't seem to work for me. I tried it but when I do a java -version it still says Java 7. – Steph Nov 23 '12 at 3:14
  • try this maybe? – Ethan Lee Nov 23 '12 at 4:28
  • 2
    It's weird, that one actually installs, which is awesome, but then when I do java -version it still says Java 7. I can't seem to find anywhere where it installs Java 6 either. I was looking in /Library/Java/JavaVirtualMachines but I only find jdk1.7.0_09.jdk in there. – Steph Nov 23 '12 at 19:11
  • I'm not familiar with system requirements for development for Android. I assume that you may concurrently run (a) at the command line, a version of the JRE that's suitable for Android development; and (b) plugged in to the web browser, a possibly different version of the JRE (whichever is preferable for apps that use the Internet plug-in). – Graham Perrin Nov 26 '12 at 8:38
2

From my understanding the actual components that need to be removed first are in /System/Library/Java/JavaVirtualMachines/*.jdk

So if you get rid of those:

$ sudo rm -rf /System/Library/Java/JavaVirtualMachines/*

Also, as you mentioned, you're supposed to remove this:

$ sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin

At this point it should simply be a matter of downloading 1.6 and installing it. If you do $ whereis java you will see that the java binaries are stored in /usr/bin/{java,javac,etc}. But $ java -version apparently gets its information from the first folder I mentioned you should delete.

After you remove those, try running $ java -version again. You should be prompted to install it.

Hope this helps!

  • This worked! After I ran both of those delete commands, I tried a java -version and it said No Java runtime present, requesting install. and it opened a window that allowed me to automatically download Java 6 and install it again. Thank you so much for the help! – Steph Nov 24 '12 at 6:16
  • After following the steps in this answer, please: which version is shown by Oracle's verification routine? – Graham Perrin Nov 25 '12 at 18:25
  • @GrahamPerrin It just keeps spinning and never says anything. – Steph Nov 26 '12 at 3:40
  • Not explicit in this answer: if you have not already done so, quit the browser and all other apps that use the plug-in. In addition to Oracle's routine you may use javatester.org/version.html to discover the version of the JRE that is plugged in (without attention to the version that is not plugged in). – Graham Perrin Nov 26 '12 at 6:29
  • 1
    +1 complementary because for as long as Oracle's misleading terminology is lodged in people's memories, answers may be difficult to express. During this period of transition (Apple-to-Oracle) I habitually read between the lines of questions, and sometimes answers, relating to Java ;-) – I encourage you to edit your own answer based on what you find. – Graham Perrin Nov 26 '12 at 7:38
2

when I do a java -version it still says Java 7.

Related, with an explanation: Why does the version of Java verified by Oracle differ from the version shown at the command line?

I tried downloading this Java for OS X update … when I try to install it I just get this message:

A newer version of this package is already installed.

For the outdated installer (2011-11-08), that's the proper response.

Current: Java for OS X 2012-006, which normally uninstalls the Apple-provided Java applet plug-in from all web browsers.

If you then allow or force installation of an outdated plug-in, please take care with all applications that will use the plug-in. (Consider vulnerabilities and so on.)

  • Thanks … different, not necessarily better. Mine is forward-looking without detailing how to install. @mmmshuddup your answer gives more thought to installation and may be comparable to an answer under Re-Enable Apple Java 6 SE from Command Line?. – Graham Perrin Nov 26 '12 at 7:47
  • lol so this question was a dupe? Sorry it's just that I don't have the usual privileges on this SE site. I can't cast close votes or anything. But yeah, well anyway I definitely appreciated the extra insight you gave! :) – Yes Barry Nov 26 '12 at 9:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .