Wednesday, April 10, 2013

Simple fix to missing tools.jar in JDK on Mac OS X

Today I ran into a situation where a 3rd-party pom.xml had a dependency on tools.jar.  I'm stuck using Java 6, due to project requirements, which means I have to use the Apple supplied JDK.  The problem is Apple bundled all the classes normally found in tools.tar into classes.jar.  Since I couldn't modify the pom file, I simply creating a symbolic link to classes.jar.
 $> sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/tools.jar  
 $> sudo ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/lib  
Problem solved!


  1. That is ok if you are a single dev. But it is a pain on a multi-dev team with multiple build machines. Will look around for a better solution and if I find it will post it here.

  2. What a pain.
    Here is a solution that works for me with out having to have a manual step. It is detailed on this page

    look under
    On Fri, Oct 18, 2013 at 2:32 PM, David Hay> wrote:

    This is not pretty though!

  3. This caused errors when compiling on mac os x: Fatal error compiling: Prohibited package name: java.lang

  4. Changed the JAVA_HOME to jdk1.7 path, on mac os x:

    mvn clean install worked fine after this.