Tip: Installing JDeveloper on Mac OS

Having gone through this a couple times now, I wanted to capture a couple tips that make JDeveloper installation easy for MacOS X users. The installation itself is very simple: a 'java -jar <jar_file>' does it all. But there is one helpful and one mandatory step you should take first. Thanks go to Steve DiMilla for trying these steps as well.

1. Set JAVA_HOME in your environment

While not really necessary (AFAIK), your life may be easier if you do. You can always just export the environment variable in a terminal, but you might as well do it properly and make it available to your whole environment. That way any process running as you has the information available. I've covered this in a previous blog, but here it is again, nice and simple. Assuming you haven't already:

  1. Create a directory in your home folder called .MacOSX (note the dot, the capitalization, etc.).
  2. Create a file in that directory called environment.plist.
  3. Copy the following into your ~/.MacOSX/environment.plist file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
    <plist version="0.9">
      <dict>
    
        <!-- When changing this, also run Java Preferences and change there. -->
        <key>JAVA_HOME</key>
        <string>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home</string>
    
      </dict>
    </plist>
    
  4. Log out and log back in.
That's it. You can use a different version than I'm using above, but at the time of this writing 1.6 is the latest. Note that Versions/1.6 is a symbolic link to Versions/1.6.0, at least right now on my machine. I prefer setting my home to 1.6 so that, presumably, if Apple removes 1.6.0 at some point and replaces it with 1.6.1, I won't have to change anything. I hope.

2. Create an rt.jar link to classes.jar

The installer for JDeveloper expects the Apple JDK to look like other JDKs. Specifically, it's looking for $JAVA_HOME/jre/lib/rt.jar, which doesn't exist by default. You're going to change that. This information is available as part of the installation insructions (section 6), but they recommend you enable the root user and do the following as root.

(Side note: enabling the root user is different on different versions of MacOS X, so the official instructions may not work for you. Here is Apple's information on enabling root.)

While doing this as root works fine, as long as you have administrative privileges, you can do the same thing with sudo and save yourself a couple steps. Here you go:

  1. cd $JAVA_HOME
  2. sudo mkdir jre (use your login password when prompted)
  3. cd jre
  4. sudo mkdir lib
  5. cd lib
  6. sudo ln -s ../../../Classes/classes.jar rt.jar
There you go. To test, head on into $JAVA_HOME/jre/lib and run a simple 'jar tvf rt.jar' if you'd like.

Now, go ahead and install. Then watch the cool overview demo to see it in action.

Comments:

You can collapse steps 2 - 5 into:

% sudo mkdir -p jre/lib
% cd jre/lib

Posted by Ryan Shoemaker on February 25, 2010 at 07:33 AM EST #

Post a Comment:
Comments are closed for this entry.
About

Whatever part of GlassFish or the Java EE world that catches my attention. (Also, go Red Sox.)

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today