Sunday, February 26, 2012

OpenJDK 7 on Apple G5 PowerPC on Mac OS X 10.5.8

Apple G5 Power Mac

  • Are you an Apple G5 owner feeling a little left out by Apple?
  • Do you have a very expensive and capable piece of hardware which can still be a valuable and fashionable?
  • Do you develop applications in Java, or run applications based on Java and feel left behind?

I have a solution for you! Use OpenJDK BSD Port!

Using a build script sent to me by Kurt Miller, build recommendations from Kelly O'Hair, and the great work of the BSD Port team... I created a new build of OpenJDK 7 for my PPC based system using the Zero VM.

The results are fantastic. I can run GlassFish 3.1.1 along with all my enterprise applications.

GlassFish 3.1.1 on Zero VM
Well it wouldn't be me if I didn't share my good fortune. I updated the Darwin9Build page for OpenJDK to demonstrate how to build OpenJDK for yourself. There are also links to the binaries too.

Here is the link: Darwin9Build


Johannes said...

Just found your post as I need it. This is absolutely great! One question: The OpenJDK I have installed on my Intel MacBook already uses Cocoa. What about the version you compiled? Is it able to use Cocoa-UI or will it use X11? Thanks you!

John Yeary said...

This particular version uses X11 since the Cocoa-UI is just now being sorted out in the JDK 7 mac-osx port. It is highly likely that we will be stuck with X11 since the effort is so large to get the support in currently.

Only time will tell.

Johannes said...

Ok, thank you. :)
Maybe you can help me with this issue as well:
I downloaded and unpacked your binary but when I try to execute I get the following error:

$ openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00/bin/java -version
Error occurred during initialization of VM
Unable to load native library: dlopen(/Users/joey/Downloads/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00/jre/lib/ppc/libjava.dylib, 1): Library not loaded: @rpath/libjvm.dylib
Referenced from: /Users/joey/Downloads/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00/jre/lib/ppc/libjava.dylib
Reason: image not found

Do you think this is because I'm trying to run on an Intel Mac (thought Rosetta would manage this) and on 10.6? I'm trying it on this system because the 10.5 system is not mine and I'd like to test this first. Is this simply impossible or is something broken?

Johannes said...

Uh, forget about my last comment. I just linked server/libjvm.dylib to the directory above and it works. ;-)

John Yeary said...

The binaries are for PPC chipsets and will not run on Intel. The binaries are part of bsd-port and are not "universal" binaries. You should be able to compile binaries for Intel based systems using bsd-port, or os x port

John Yeary said...

Are you sure?

Johannes said...

Yes, it seems Rosetta is doing the work. But it seems it is not able to detect the X11 server. I get exceptions like this one:

$ ./bin/java -jar /Users/joey/Downloads/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00/demo/jfc/Notepad/Notepad.jar
Feb 27, 2012 9:40:19 PM Notepad main
Schwerwiegend: uncaught exception
at java.awt.EventQueue.invokeAndWait(
at javax.swing.SwingUtilities.invokeAndWait(
at Notepad.main(
Caused by: java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(

Does this work with your environment?

John Yeary said...

Try setting -Djava.awt.headless=false from the command line while running your application.

Johannes said...

Yep, found this, too. ;) Thank you anyways! This helps - now I just have to install the correct (older) version of X11 so that the lib-versions fit.

Benson Lim said...

Thanks John. I tried to run a simple swing app, java -Djava.awt.headless=false TextDemo
and I got the following error

Exception in thread "main" java.lang.UnsatisfiedLinkError: /System/Library/Frameworks/JavaVM.framework/Versions/openjdk7/jre/lib/ppc/xawt/libmawt.dylib: dlopen(/System/Library/Frameworks/JavaVM.framework/Versions/openjdk7/jre/lib/ppc/xawt/libmawt.dylib, 1): Library not loaded: /usr/X11/lib/libX11.6.dylib
Referenced from: /System/Library/Frameworks/JavaVM.framework/Versions/openjdk7/jre/lib/ppc/xawt/libmawt.dylib
Reason: Incompatible library version: libmawt.dylib requires version 10.0.0 or later, but libX11.6.dylib provides version 9.0.0

Any ideas?

John Yeary said...

I have a suspicion. Which version of X-Windows are you using? The default version, or XQuartz?

I believe I this may be using XQuartz, but I can not check the build machine at the moment since I am at my office.

Unknown said...

exist an easy way to install this? any installer or some similar.

John Yeary said...

There are links to binaries located on the Darwin9Build wiki located here which include mine.

Herald said...

I'm trying to run run minecraft with OpenJDK 7. I'm doing something along the lines of:

#! /bin/sh
export DYLD_LIBRARY_PATH="/usr/local/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00"
java -Xmx1024M -Xms512M -cp ~/MinecraftSP.jar net.minecraft.LauncherFrame

But it keeps opening it with the system Java. I'm guessing I'm setting DYLD_LIBRARY_PATH wrong?

John Yeary said...

Sorry for the slow response, but I was at JavaOne and inundated with an insane amount of email before, during, and after.

Did you try setting the environment like:
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`

I think that may solve it for you.

Tyler said...

Hi. I'm not a programmer but I can follow tutorials fairly well. My issue is this. I've followed you instructions along with referring to Stephen Bannasch's instructions at for the parts that I needed some more elaboration on. but I got to the build stage (at least I thought I did) and copied your (inserting my own bootdir folder) and tested it out using "source". but as soon as I hit enter, nothing happens and I'm back to the $ with no errors or sign of it working at all. Any help please. I'm on PPC G5. if you need a better text environment to exchange info just email me.

Dimitar said...

I am trying to install OpenJDK 7 on my Mac OS 10.5.7 ppc box following the instructions in this article.

The compilation fails because of these errors:

/Users/dgeorgie/Projects/openjdk/bsd-port/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp: In static member function 'static void CppInterpreter::process_method_handle(oopDesc*, Thread*)':
/Users/dgeorgie/Projects/openjdk/bsd-port/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp:817: error: 'get_ek_bound_mh_info' is not a member of 'MethodHandles'
/Users/dgeorgie/Projects/openjdk/bsd-port/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp:965: error: 'get_ek_adapter_opt_swap_rot_info' is not a member of 'MethodHandles'

Any idea what is causing them and how to fix them?



John Yeary said...

I got a request from someone last night for a PPC build. I had not built one in a long time, and it would not work for me last night.

I would have to investigate the issue, but it would be for 10.5.8 since that is what I have available.

The current build only seems to want to make x86/64 based builds. I will need to determine when that change was made.

The PPC builds may be on the last legs if there is no additional work being done. There is a build available from the Darwin9 build page it points to one of my last successful builds.

Unknown said...

I need help, I am trying to use this to use launcher for Minecraft, but I keep getting a bunch of errors that I do not understand, can you maybe use teamviewer or something to help me install it?

Unknown said...

I have no clue how to install this, can you maybe do a teamviewer session to help me install it?

Chris said...

Hello, I am wondering if you have ever built a 64 bit openjdk 7 for powerpc, or if you would have any caveats/changes to the online build instructions if I try to build it myself. I have a PowerMac G5 Quad with 8 GB of ram , and I want to use a 64 bit version of java to use with minecraft and/or a minecraft launcher. I figured it would be nice to have a newer version of java to bundle with the launcher to get rid of some problems I'm having using the old Apple java.

John Yeary said...

I do have a 64-bit build for OpenJDK, but it is old. The latest version of OpenJDK for BSD port does not support PPC. I would need to go back and determine the last known good version to do a 64-bit build from.

Here is one build

I will see if I can post my 64-bit version.

John Yeary said...

I don't provide technical support/assistance on installing software using remote desktop software like teamviewer (which I do not own)on other people's computers unless I am paid. Doing technical support for free would open a can of worms I don't want to do. That said, I will help by answering specific questions. I have helped a number of folks who have contacted me via email.

I suggest that instead of building it on your own which can be infuriating, that you use the build I have posted in one of the comments above.

Chris said...

Hi again! I would just like to say that if anyone must have 64 bit java on their powermac G5, they should look into putting a ppc64 linux on it, and compiling the openjdk ppc64 linux port. I will try this out, and if i can get stuff working i will try to help out other people!

Popular Posts