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.
- Downloaded OpenJDK, Java 1.7 from https://wikis.oracle.com/display/OpenJDK/Darwin9Build
- Changed permissions
- Copied / moved new package to temporary location to uncompress and unpack the content : /usr/java7
- Fixed up permissions and ownership of the components
- Confirmed setup would work in it’s temporary home and was in fact jdk 1.7
- 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.
- Moved everything from /usr/java7 to /System/Library/Frameworks/JavaVM.framework/Versions/1.7.0 folder
- Used the temporary /usr/java7 folder as the landing place for all the new soft logical links pointing to my new jdk 1.7
- 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)
- Log out or reboot
- 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.
- 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
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
Is it here before unpack ? Yes.
iMac:java7 jim$ cd /usr/local/
iMac:local jim$ ls -al
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
Went into the folder holding the payload executables
Let’s see if 1) they will execute or not 2) what jdk/sdk version are they ?
should say jdk 1.7-ish !!!
Went back to user home folder
What’s here ?
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 :
Er, no, not yet.
Made a new jdk 7 folder in the typical apple location
sudo mkdir 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
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 .
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
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 PS1=”\u@\h\w: “
iMac:~ jim$ echo $PATH
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
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…
// 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
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
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 !!!