Thursday, September 8, 2011

JDeveloper: JDeveloper on Mac OS X Lion (10.7)


As you may know, Apple does not to ship JDK6 with OS X Lion. So you first need to get JDK6 installed on Lion, which is really easy. One way to install JDK6 on Lion is to simply enter java -version at a terminal prompt. If the JDK is not installed, you'll be prompted by Lion to download and install it (just follow the installation screens provided by Apple).
Now that you have JDK6 installed on Lion, you need to download and install JDeveloper.

(1) Download JDeveloper from here to your desktop.  (Choose the *generic* Studio Edition from the pull-down menu.)     

(2) Double-click on the package you just downloaded, which should be jdevstudio1112Oinstall.jar. Be patient because it may take a few moments for the first screen of the JDev Installer to come up.

(3) Follow the Installer's step. The tricky part is when you get prompted for providing the path to you local JDK. When you get there, just follow step (4) below.

(4) To make it easy for the JDev Installer to find the all Java libs it's looking for, you need to run the following bash script. Just copy the script below in a text editor and save the file as jdev_on_lion.sh (or any other name.sh you choose).  Here is the bash script:

#!/bin/bash 

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/java /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/java

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/javac /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/javac

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/javap /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/javap

ln -s /System/Library/Java/Support/Deploy.bundle/Contents/Home/bin/javaws /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/javaws

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/jar /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/jar

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/xjc /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/bin/xjc

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/lib

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/classes/classes.jar /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/lib/tools.jar

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/jre

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/jre/bin

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/bin/java /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/jre/bin/java

mkdir /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/jre/lib

ln -s /system/library/java/javavirtualmachines/1.6.0.jdk/contents/classes/classes.jar /system/library/java/javavirtualmachines/1.6.0.jdk/contents/home/jdk6/jre/lib/rt.jar

(5) Now that you've saved the script as described in step (4), you need to run it. Before running it, however, you need to change the file access permissions by entering the following command at a terminal prompt: chmod +x jdev_on_lion.sh

(6) You're ready to run the script. Enter the following command at a terminal prompt: ./jdev_on_lion.sh (if the bash shell complains that some permissions are (still) denied, just enter the command preceding it with "sudo" (you'll be required to enter your Mac password), that will always work!)

(7) Now you should see the JDK's path automatically entered in the JDev install screen. 

(8) You just need to follow the remaining JDev Installer steps to complete installation.