Application classpath and tools.jar

Mike Swingler swingler at apple.com
Sun Feb 19 09:49:38 PST 2012


On Feb 19, 2012, at 5:06 AM, Michael Hall wrote:

> Another behavior change between the Apple jvm's and the openjdk ones is that tools are no longer included in default system classpath.
> I have added functionality into my application that needs tools.jar with 1.7.
> I have been testing with a version of this jar file pulled out to a location that I can conveniently reference in classpath specifications either from Eclipse or from my application.
> This will of course not work for my application when on any other machine where the jar file has not been moved. 
> I have been considering as a solution determining the path to tools.jar and providing a ClassLoader at runtime that will load from it.
> So far with no success. Details of failures omitted unless of interest to anyone.
> Before, or while, I'm setting up a simpler standalone test case and starting to dig into why the ClassLoader solution isn't working.
> 
> Is there a simple correct way to specify classpath, particularly for bundle applications, that can be used to point to the tools.jar location in the current jdk bundle?
> I don't yet have a working 1.7 openjdk version application bundle but believe that should be very near.

At runtime, you could find tools.jar relative to the "java.home" system property. Alternately, you could file an enhancement request to the JavaAppLauncher to substitute a $JAVA_HOME variable like the original contributed implementation substituted $JAVAROOT, $APP_PACKAGE, and $USER_HOME.

Regards,
Mike Swingler
Apple Inc.



More information about the macosx-port-dev mailing list