Java Open JDK 7 / SDK 1.7 for Apple PPC iMac / Macbook G3, G4 and G5 – Part 2

Review

Please read part one for links to references that helped with this installation. After completing these steps, my aging Apple iMac PPC system had a fully functional openJDK 1.7 and now google app engine is happy and no longer gives me a bad version in class file message. Ok, the down-side of this way of doing it is that the apple-specific features that make java gui’s look-like-an-apple are not there. I can live with that as i do not do much java gui desktop hacking anyway. If you do, you may need to re-think this approach.

Essential Steps

  1. Downloaded OpenJDK, Java 1.7 from https://wikis.oracle.com/display/OpenJDK/Darwin9Build
  2. Changed permissions
  3. Copied / moved new package to temporary location to uncompress and unpack the content : /usr/java7
  4. Fixed up permissions and ownership of the components
  5. Confirmed setup would work in it’s temporary home and was in fact jdk 1.7
  6. Created a final folder the the standard apple folder to place the 1.7 assets and where it all would reside. Just to keep things tidy, chose to put this into the apple folder (see below) at /System/Library/Frameworks/JavaVM.framework/Versions/ so it sits in the apple folder used for the apple versions of java.
  7. Moved everything from /usr/java7 to /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0 folder
  8. Used the temporary /usr/java7 folder as the landing place for all the new soft logical links pointing to my new jdk 1.7
  9. Changed all the PATH setup files to have /usr/java7 before the apple supplied same in /usr/bin where all the soft links to apple’s java versions sit, think this was the ~/.profile and .bashrc and some others i forgot to write down (google around to find out which ones you need on your system)
  10. Log out or reboot
  11. From terminal command line tried java -version and javac -version to confirm success, Houston we have lift-off !! JDK 1.7 is ready !!! Therefore since, /usr/java7 links are available before the typical apple links to java in /usr/bin folder, it all seems to hang together. Hope yours does too.
  12. Retry google app engine 1.7.0 and voila !

—-

Took kurt miller’s macppc build choice of jdk 7 to download from https://wikis.oracle.com/display/OpenJDK/Darwin9Build after download was complete, went into my download folder:

Changed directories to the download folder and changed the permissions of the downloaded jdk payload, just to avoid authority/permissions issues
sudo chmod 777 openjdk7u2-macppc-fcs-2012-03-14.tar.bz2

Moved the jdk to my /usr/local folder as a temporary landing place
sudo mv openjdk7u2-macppc-fcs-2012-03-14.tar.bz2 /usr/local/

Went into that folder
cd /usr/local/

Uncompressed the jdk payload to get to the .tar
sudo bzip2 -d openjdk7u2-macppc-fcs-2012-03-14.tar.bz2

Unpacked the tape archive using tar command

sudo tar -xvf openjdk7u2-macppc-fcs-2012-03-14.tar
cd /usr/local/openjdk7u2-macppc-fcs-2012-03-14
ls -al

Is it here  before unpack ? Yes.
// ————————–
iMac:java7 jim$ cd /usr/local/
iMac:local jim$ ls -al
total 286464
drwxr-xr-x   5 root  wheel        170 27 Jul 17:01 .
drwxr-xr-x@ 13 root  wheel        442 27 Jul 23:41 ..
drwxr-xr-x  14 jim   admin        476 26 Jul 23:55 bin
drwxr-xr-x   8 root  wheel        272 23 Dec  2009 git
-rwxrwxrwx   1 root  staff  146667520 27 Jul 01:08 openjdk7u2-macppc-fcs-2012-03-14.tar
// ————————–

Went into that folder
cd openjdk7u2-macppc-fcs-2012-03-14

Went into the folder holding the payload executables
cd bin/

Let’s see if 1) they will execute or not 2) what jdk/sdk version are they ?
./java -version
./javac -version

should say jdk 1.7-ish !!!

Went back to user home folder
cd ~

What’s here ?
ls -al

If we have fixed the paths in the .profile (see below for edit ideas), then these commands are part of the soft links to our new java :
java
java -version

Er, no, not yet.

Made a new jdk 7 folder in the typical apple location
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo mkdir 1.7.0
cd 1.7.0

cd /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0

// here’s a look at my folder setup after the above steps. Note the new 1.7.0 folder created to host the openJDK assets
// —————————————————————–
iMac:~ jim$ cd /System/Library/Frameworks/JavaVM.framework/Versions/
iMac:Versions jim$ ls -al
total 48
drwxr-xr-x  13 root  wheel  442 27 Jul 12:04 .
drwxr-xr-x  12 root  wheel  408  3 Aug  2011 ..
lrwxr-xr-x   1 root  wheel    5  3 Aug  2011 1.3 -> 1.3.1
drwxr-xr-x   3 root  wheel  102 29 Sep  2007 1.3.1
lrwxr-xr-x   1 root  wheel    5 18 Sep  2009 1.4 -> 1.4.2
lrwxr-xr-x   1 root  wheel    3 22 Dec  2007 1.4.1 -> 1.4
drwxr-xr-x   8 root  wheel  272 22 Dec  2007 1.4.2
lrwxr-xr-x   1 root  wheel    5  3 Aug  2011 1.5 -> 1.5.0
drwxr-xr-x   8 root  wheel  272 22 Dec  2007 1.5.0
drwxr-xr-x  14 root  wheel  476 27 Jul 12:06 1.7.0  <—- new folder as permanent home for jdk 1.7
drwxr-xr-x   9 root  wheel  306 27 Jul 17:08 A
lrwxr-xr-x   1 root  wheel    1 27 Jul 00:44 Current -> A
lrwxr-xr-x   1 root  wheel    5 10 May 17:11 CurrentJDK -> 1.5.0
// —————————————————————

Moved all the bits from jdk7 in /usr/local to here
sudo mv /usr/local/openjdk7u2-macppc-fcs-2012-03-14/* .

Changed owners on all asets
sudo chown -R root:wheel .

// ——————————————–
Went home
cd ~

Ready to fix some path declarations to point to the new /usr/java7 folder full of links plus something for my google app engine install – you won’t need to do APP_ENGINE_HOME if you do not use google app engine. Just place /usr/java7 before the /usr/bin folder in your path identified by $PATH in our export statement below
sudo nano .profile

// ——————————-
export DERBY_HOME=/Volumes/Media/Software/derby/db-derby-10.5.3.0
export GROOVY_HOME=/Volumes/Media/Software/groovy-1.9.0
export PLAY_HOME=/Volumes/Media/Software/Play-1.2.4
export APP_ENGINE_HOME=/Volumes/Media/Software/appengine-java-sdk-1.7.0
export PATH=”.:$PLAY_HOME:$DERBY/bin:$GROOVY_HOME/bin:/usr/java7:$PATH”

then ctrl+o +enter key to save
then ctrl-x  to exist
// ———————————–

Make your export PATH declaration look similar to the above.

// —————————-
also may need to fix up / review paths in :
sudo nano .bash_profile
sudo nano .bashrc

// —  when successful, my new PATH variable looks like this:
iMac:Versions jim$ cd ~
iMac:~ jim$ cat .profile
export DERBY_HOME=/Volumes/Media/Software/derby/db-derby-10.5.3.0
export GROOVY_HOME=/Volumes/Media/Software/groovy-1.9.0
export PLAY_HOME=/Volumes/Media/Software/Play-1.2.4
export APP_ENGINE_HOME=/Volumes/Media/Software/appengine-java-sdk-1.7.0
export PATH=”.:$PLAY_HOME:$DERBY/bin:$GROOVY_HOME/bin:/usr/java7:$PATH”
export PS1=”\u@\h\w: “

iMac:~ jim$ echo $PATH
.:/Volumes/Media/Software/Play-1.2.4:/bin:/Volumes/Media/Software/groovy-1.9.0/bin:/Volumes/Media/Software/appengine-java-sdk-1.7.0/bin:/usr/java7:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin

// ————————————————————–
So notice how /usr/java7 links to java are in the path ahead of/before /usr/bin ?
This way, the new pointers and links to the openJDK7 assets are found first when OSX does a path search for executables

My /usr/bin looks like this and has apple declared soft links to their version of java :
iMac:bin jim$ pwd
/usr/bin

// —————————————————————
iMac:bin jim$ ls -al j*
lrwxr-xr-x   1 root  wheel     73 10 May 16:55 jar -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jar
lrwxr-xr-x   1 root  wheel     79 10 May 16:55 jarsigner -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jarsigner
lrwxr-xr-x   1 root  wheel     74 10 May 16:55 java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
lrwxr-xr-x   1 root  wheel     75 10 May 16:55 javac -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac
-r-xr-xr-x   1 root  wheel  50976 24 Sep  2007 javaconfig
lrwxr-xr-x   1 root  wheel     77 10 May 16:55 javadoc -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javadoc
lrwxr-xr-x   1 root  wheel     75 10 May 16:55 javah -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javah
lrwxr-xr-x   1 root  wheel     75 10 May 16:55 javap -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javap
-r-xr-xr-x   1 root  wheel  72336 24 Sep  2007 javatool
lrwxr-xr-x   1 root  wheel     76 10 May 16:55 javaws -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaws
lrwxr-xr-x   1 root  wheel     78 10 May 16:55 jconsole -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jconsole
lrwxr-xr-x   1 root  wheel     73 10 May 16:55 jdb -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jdb
lrwxr-xr-x   1 root  wheel     74 10 May 16:55 jhat -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jhat
lrwxr-xr-x   1 root  wheel     75 10 May 16:55 jinfo -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jinfo
lrwxr-xr-x   1 root  wheel     74 10 May 16:55 jmap -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jmap
lrwxr-xr-x   1 root  wheel     73 10 May 16:55 jps -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jps
lrwxr-xr-x   1 root  wheel     79 10 May 16:55 jsadebugd -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jsadebugd
lrwxr-xr-x   1 root  wheel     76 10 May 16:55 jstack -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jstack
lrwxr-xr-x   1 root  wheel     75 10 May 16:55 jstat -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jstat
lrwxr-xr-x   1 root  wheel     76 10 May 16:55 jstatd -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jstatd
lrwxr-xr-x   1 root  wheel     72 10 May 16:55 jvisualvm -> /System/Library/Java/Support/VisualVM.bundle/Contents/Home/bin/jvisualvm
// ————————————————————-

Ok, then made another folder for all the new soft links to the new java – the one we declared in the changes above…
mkdir /usr/java7
cd /usr/java7

// created all these soft links essentially duplicating all those found in normal apple folders
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/java java
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/javac javac
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/javadoc javadoc
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/javah javah
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/javap javap
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/javaws javaws
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jconsole jconsole
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jdb jdb
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jhat jhat
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jinfo jinfo
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jmap jmap
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jps jps
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jstack jstack
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jstat jstat
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jstatd jstatd
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/keytool keytool
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jar jar
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/jarsigner jarsigner
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/extcheck extcheck
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/apt apt
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/appletviewer appletviewer
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/idlj idlj
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/orbd orbd
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/pack200 pack200
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/policytool policytool
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/unpack200 unpack200
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/tnameserv tnameserv
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/serialver serialver
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/servertool servertool
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/rmiregistry rmiregistry
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/rmic rmic
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0/bin/rmid rmid

Fixed up permission
sudo chmod 777 *

Went home to see if path changes took – no!
Had to open a new terminal session to use new changes so that fresh path layout was seen in new terminal session.
Rebooted system just to be sure.

After reboot, brought up a terminal window and went home

cd ~

// ————–>
Tried these commands to confirm successful placement of java 7 above/before the apple version of java found in /usr/bin which pointed to jdk 1.5 on my system (and still does). we have not disabled the apple versions, but apple OSX does not really know that JDK 1.7 is in place.

iMac:java7 jim$ javac -version
javac 1.7.0-internal

iMac:java7 jim$ java -version
openjdk version “1.7.0-internal”
OpenJDK Runtime Environment (build 1.7.0-internal-truk_2012_03_14_11_04-b00)
OpenJDK Zero VM (build 22.0-b10, interpreted mode)

Now tried the google app engine app_devserver.sh command again and voila, we have a happy google app engine we can use for development with openJDK 7

Thanx to Kurt Miller for his heroic efforts to put it all together for us old iMac users !!!

3 thoughts on “Java Open JDK 7 / SDK 1.7 for Apple PPC iMac / Macbook G3, G4 and G5 – Part 2

  1. probably no need for all the moving around and creating links, just add the new java bin in the path ahead of the others.. .. the overall directory structure of this package looks different than apple’s installed components — any clue about all those custom directories ? maybe to include all the apple specific stuff. that would put this distro (thanks for the binaries!!) in

    /System/Library/Java/JavaVirtualMachines/1.7.0.jdk/{Home}

    and links in

    /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0 pointing back..

    directory structure of other versions would indicate this would go in ./Home under any of those directories..

    wondering whats going to happen when system is looking for all the extra stuff in mac-standard-nonstandard places with the new version. fyi, don’t even attempt the mercurial build without broadband!

  2. it might even cause problems with other software to put this new java in the whole login environment (ie, .bash_profile), rather, add the /wherever/1.7.0/bin:$PATH to a shell script used to startup app-engine or whatever.. at least if any library versions get mismatched or some program is looking for the apple specific components or needs the older version, the newer version is isolated to the package started up via that script, and won’t affect the entire desktop session.

  3. Hello thank you for writing this guide I searched nearly the whole day and finally made progress with your guide!! I’m happy but I still need help with your guide.. I got to ./java -version ./javac -version to say openjdk7 but then when i reboot it doesnt… where am i stuck? what did i miss please help me….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s