Thursday, December 6, 2007

Using OpenJDK 1.6 (Java 6) with IntelliJ

I have been able to use the SoyLatte (a.k.a. version 1.0 of the Java 6 Port for Mac OS X 10.4 and 10.5) to compile my projects in IntelliJ. It was fairly painless. To do so:

  1. Install OpenJDK 1.0. Brandon recommends putting it in /usr/local/soylatte16-amd64, but I went ahead and put it in /System/Frameworks/JavaVM.Framework/Versions. Makes more sense to me that way, but it doesn't really matter.

  2. In IntelliJ open up your project preferences (Cmd-,)

  3. Click on "JDKs"

  4. Add a new one.

  5. Add the following jars to the classpath:
    ${install_dir}/soylatte16-i386-1.0/lib/dt.jar
    ${install_dir}/soylatte16-i386-1.0/lib/jconsole.jar
    ${install_dir}/soylatte16-i386-1.0/lib/tools.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/charsets.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/jce.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/jsse.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/management-agent.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/resources.jar
    ${install_dir}/soylatte16-i386-1.0/jre/lib/rt.jar

And you're done. Note that this is only to compile existing projects with Java 6 using IntelliJ. If you want to launch IntelliJ with Java6 you're on your own.

No comments: