69

My Mac currently is running Snow Leopard (10.6.8), and I would like to develop with Java 7. I downloaded the Java 7 OS X installer from Oracle's website, started to run it. Unfortunately, I was immediately greeted with a message that said the installer is supported only on OS X Lion (10.7.3). Is there any way I can get Java 7 on my machine with Snow Leopard? I am not buying a new OS just to upgrade my Java. I googled around some, but I am not finding much. I'm hoping I can find some help here. Thanks.

dnc253
  • 39,967
  • 41
  • 141
  • 157
  • I didn't know this wasn't working until I tried to add the JDK to the IDEA IDE. – anizzomc Aug 05 '13 at 00:47
  • I think the upgrade to Mavericks may be free now? – David Mann Mar 21 '14 at 18:26
  • 2
    @DavidMann the cost of Mavericks isn't the issue. I'm in the same boat. I put Mavericks (clean install) on my 2009 MBP and it ran like gravy through a Capri Sun straw. And I saw no real benefit. 99% of my MBP usage is for Java/Arduino development and YouTube. It's ridiculous that we're forced to either buy another MBP or cripple our "still good" MBP just so we can run the MORE SECURE version of Java. Shame on Apple and Shame on Oracle. – cbmeeks May 22 '14 at 19:06
  • absolutely agree, what's the point in installing a bloated OS made to impress a girlfriend and replace the minimalist, fast, rock-solid Snow Leopard? – rupps Feb 24 '15 at 13:41

9 Answers9

42

Use Pacifist from http://www.charlessoft.com/ to open and install the 'JDK 7 Update X.pkg' in the 'jdk7-7uX-macosx-x64.dmg' file you download from http://www.oracle.com/technetwork/java/javase/downloads/index.html

reukiodo
  • 740
  • 6
  • 12
  • 2
    Hi, I followed your procedure as well, but it seems Maven (3.0.4 and 3.0.5 at least) do not work. I indeed get "java.lang.AssertionError: Platform not recognized". Am I the only one facing this? – fbiville Mar 03 '13 at 20:24
  • 1
    @Rolf Did you set the JAVA_HOME variable ? On my configuration I've set the following for command line arguments `JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home`. Also it might interest you to have a look at the following program `/usr/libexec/java_home`. – bric3 Mar 04 '13 at 14:07
  • But none is bundled in the JDK I downloaded. The current java_home points to the one bundled in a JDK v6. – fbiville Mar 04 '13 at 18:19
  • 2
    So does using this method mean that the `/usr/libexec/java_home` program doesn't reflect the newly installed JDK7 package? I have installed JDK7 on another (newer) Mac that has OS X 10.9, and after installing the package, then `/usr/libexec/java_home` pointed to it. But is that not the case when installing it via Pacifist? – Jeff Evans Nov 23 '13 at 00:21
  • Thanks. Worked perfectly. To get sbt (and other terminal apps) to pick this up I did: `echo 'export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home' >> ~/.profile` – Matt Roberts Jan 10 '14 at 07:32
  • 3
    I had the same problem installing Java 7 for snow Leopard Mac. Installed Pacifist and installed Java package through pacifist. Then through Java Preferences.app reordered java hierarchy to have java 7 as the top priority. – Ramin Jan 22 '14 at 21:43
  • It works, but trying to launch a Bukkit server, it crashes after a while with a fatal JVM error. – sudo Mar 27 '14 at 00:23
  • What about when there's Java 7 updates? Will Java tell you there's an update available or do I need to manually check? Will the installer now run or do I have to extract "JDK 7 Update X.pkg" each time? – Marc Apr 18 '14 at 19:05
  • I was trying to use my MAC for Android development, it asked me for JDK 7, and then I followed the instructions above and it worked. – perceptron Jan 10 '15 at 03:57
  • _-- Pacifist is compatible with Mac OS X 10.8 or higher._ – 1615903 Apr 20 '16 at 10:16
24

From what I have read JDK 7 does not require 10.7+ so I simply opened the shipped .pkg installer file with PackageMaker (an Xcode tool) and removed the OS version requirement and re-built it.

You will need to copy the installer out of the .dmg file since you have to save changes.
Edit: You will need to Build to another directory as the mounted .dmg is read-only.

So far in my using this I haven't experienced any issues, even the Java preference pane is working properly.

One thing to note, you will have to reorder JDKs in Java Preferences.app to get programs to use the new JDK instead of Java 6.


I've even gone as far as to copy the Java 7 .jdk bundle into /System/Library/Java/JavaVirtualMachines/, and it seems to be function normally.

Just don't move/rename the JDK bundles while Java applications are running; not that I've done that by accident or anything...

Hawken
  • 2,059
  • 19
  • 34
  • I followed the steps mostly successfully, beside Symbol not found: _JNFRunLoopDidStartNotification in JavaNativeFoundation. It might be that something went wrong during my mac upgrade, apparently _JNFRunLoopDidStartNotification was added in 10.6.5, and I'm on 10.6.8, but native bindings do not have that symbol, so quite risky I took JavaNativeFoundation from 10.7.3 and it works! – avalez Feb 12 '13 at 20:03
  • @avalez That's good, up till this point I only knew that it worked for me. What were you doing to get the "Symbol not found" ? – Hawken Mar 06 '13 at 21:43
  • I've been starting tomcat. Though I somehow solved it, first copied the file from Lion, but applets were crashing firefox, and then installed all updates for Snow Leopard (not sure if it updated the file too), no problems since then. – avalez Mar 07 '13 at 22:40
  • 1
    I've found this [post](https://github.com/hgomez/obuildfactory/issues/3#issuecomment-22942575) mentioning that JDK 7 may work fine as long as AWT (i.e. window apps) is not used. – alexandroid Aug 21 '13 at 05:58
  • @alexandroid Hmm, I was pretty sure I used AWT with JDK 7 at some point. I didn't see any issues at all, but hey, mileage may vary. – Hawken Aug 24 '13 at 17:18
  • How can I verify that I rebuilt correctly? I followed the recommendation and after install, it wanted me to restart my Macbook, which I did. When I open Java preferences, I do not see Java 1.7; from terminal command-line, java -version is reporting 1.6.0_65. ALSO NOTE: I recommend a backup before this action. – mobibob Feb 15 '14 at 20:01
  • @Hawken I've not been able to use the AWT minecraft launcher with JDK 7 packaged this way. – Wyatt Ward Oct 15 '15 at 15:15
9

I had the same problem and was not able to google the proper way to do it. At the end I came up with solution myself and put it on my blog:

http://jksha.blogspot.se/2013/09/java-7-and-snow-leopard-osx-106.html

  • This doesn't work for groovy. I installed jdk 7 using this method, and got errors when running `groovysh`. The errors disappeared when I switched back to jdk 6. – JBT Dec 31 '13 at 06:59
  • This 'faking the OS version temporarliy' was easier than messing around with repacking pkg files. – Greg Domjan Jul 06 '14 at 11:09
  • This answer worked for me, while the other answers (using Pacifist or similar) did not...with Pacifist, while I could run java7 from the terminal, I was unable to get Eclipse or Utilities/Java\ Preferences to recognize it – jackkamm Dec 05 '14 at 23:38
  • This did not work for me installing the JRE on 10.6.8. It said it installed, but now my /Library/Java/JavaVirtualMachines/ dir is empty, and when I type 'java' in terminal, it says 'Unable to find a Java Runtime to invoke.' Not sure how to fix it either... – phreakhead Jan 29 '15 at 06:45
  • @NiksaJakovljevic I do not have the right to temporarily change the file `SystemVersion.plist`. What should I do? – Karlo Nov 09 '16 at 20:28
6

The answer from @reukiodo is definitely the way to go, so thanks a bunch!. However, it might need some further explanation for newbs like myself.

  1. Download the two DMG's that @reukiodo posted links to.
  2. Install Pacifist.
  3. Open the java-DMG with pacifist.
  4. In the 'Package Contents'-tab (default tab), select the 'Contents of JDK 7 Update XX.pkg' (XX being e.g. 51)
  5. Click the 'Install' button and follow the on-screen instructions.
  6. Open Java Preferences.app in yout Utilities folder and drag Java SE 7 to the top of the list of Java versions in the 'General'-tab (default tab)
  7. (OPTIONAL: Work with Eclipse: Follow the steps by Heath Borders answered to another, but similar question. NB! This is actually for OSX 10.7 Lion, but the same procedure holds, and it worked for me on 10.6.8 Snow Leopard.)
Community
  • 1
  • 1
larsac07
  • 61
  • 1
  • 3
  • 2
    I got to step 6 and couldnt find Java 7 when I opened Java Preferences.app's general tab.. am I missing something or is it because this is Java 7 update 60? :-/ – MTA Jun 10 '14 at 19:36
2

There are two ways to do this.

  1. Download Pacifist from charlessoft.com and open the JDK PKG in it (and extract the application.)
  2. Open the PKG in PackageMaker (a tool for developers) and remove the requirement of 10.7.3.

Good luck!

Farvardin
  • 5,336
  • 5
  • 33
  • 54
ultimatetechie
  • 348
  • 3
  • 14
2

I was able to compile openJDK 7 for snow leopard (works entirely, AWT included), from some patches at this project:
https://github.com/hgomez/obuildfactory/

If you want my binaries for a little bit of an easier time, here they are:
https://bintray.com/wyatt8740/generic/openjdk7-sdk-osx-10.6/20140622/view

The tarball is about 57 megabytes.

Extract it under /Library/Java/JavaVirtualMachines/. The JDK will be in a directory called jdk1.7.0.jdk. Set your JAVA_HOME environment variable to /Library/Java/JavaVirtualMachines/jdk1.7.0.jdk/Contents/Home, and from then put the command for setting JAVA_HOME in your ~/.profile to make it more permanent. Log out and in for it to take full effect. The only thing missing so far is a JDK 7 browser plugin.

You can also use the "Java preferences' app (can be found in spotlight search) to set it to the default when accessed via GUI as well.

Unfortunately, I don't have access to OS X at the moment to try to make java 1.8 work, so 1.7 is probably the end of the road for 10.6.

Wyatt Ward
  • 1,056
  • 12
  • 18
  • 1
    Do you mind if I redistribute your binary to use my application Jubler in older versions of OSX? – Panayotis Oct 28 '17 at 13:24
  • @Panayotis Go ahead! Out of curiosity, how many people? (No matter how many, the answer is still "go ahead, no problem" - I'm just curious how many people I've helped!) – Wyatt Ward Oct 28 '17 at 17:47
  • @Panayotis - BTW, i see on your page you misspelled my name. (http://www.jubler.org/osx_sl.html) – Wyatt Ward Oct 28 '17 at 17:53
  • 1
    Oh I am sorry, fixed! I don't know yet, just uploaded it. But I know that there are a lot of people who have old hardware that is not upgradable (thanks Apple). Up to now I had to create two releases of the software but now I can create only one. – Panayotis Oct 28 '17 at 18:44
  • @Panayotis Tell me about it. I've got a 2006 intel 64-bit imac that can't go over 10.7 and keep graphics acceleration. It now runs Debian linux (dual booting with OS X 10.6 since I can't buy 10.7 anymore). Also a Powerbook G4 (which also runs Debian). Apple's the king of obsolete hardware. Thanks! – Wyatt Ward Oct 30 '17 at 13:46
1

You can build your own one. I did this before. It was easy. And it's as official as you can probably get:

https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port

  • That says that the minimum OS version is OS X 10.7.3. You actually built it with 10.6.x? – dnc253 Nov 23 '12 at 23:20
  • Probably I built it with 10.7.x. Probably. But they say "...It should continue to run on 10.6.8 + Java for Mac OS X 10.6 Update 6 but that is not guaranteed..." Just try it! –  Nov 23 '12 at 23:24
1

I have changed the version in the /System/Library/CoreServices/SystemVersion.plist based on this video tutorial http://www.youtube.com/watch?v=eFi-H-7-PD4

banterCZ
  • 1,551
  • 1
  • 22
  • 37
0

What you want is not impossible but for sure NOT recommended but... once you are sure that this is what you want, here is an easy way to install Java (or any software for OS related matters): - navigate to you MainHD/System/Library/CoreServices/SystemVersion.plist - backup this file !! - open it in Text editor and alter the product version:

    <key>ProductUserVisibleVersion</key>
<string>10.6.8</string>
<key>ProductVersion</key>
<string>10.6.8</string>

according to you needs.

Warning: A samurai take 7 breaths before taken any decision.

LAOMUSIC ARTS
  • 642
  • 2
  • 10
  • 15