Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » "external:" Bundle-ClassPath and PDE UI(Discussion regarding bundle classpaths of the style: Bundle-ClassPath: external:$java.home$/../lib/tools.jar)
"external:" Bundle-ClassPath and PDE UI [message #1058958] Thu, 16 May 2013 01:39
Arcadiy Ivanov is currently offline Arcadiy IvanovFriend
Messages: 1
Registered: May 2013
Junior Member
I need to incorporate tools.jar into the bundle so that I can import package "" and export the same package respectively.

Things I can't/won't do:

1) Drag a 12MB tools.jar copy into the bundle.
Reasons: (a) every time java is upgraded (even between the minor fix releases) I'll either have to upgrade tools.jar or verify it's the same (b) I may need to use the application with Java 1.7 and 1.6 and if tools.jar change I can't drag around two copies.

2) Use -cp JDK_PATH/lib/tools.jar + org.osgi.framework.system.packages.extra
Reasons: This requires every executable to have that -cp and every eclipse configuration to have the org.osgi.framework.system.packages.extra. I run automated tests with on the fly p2-generated configuration and developers run Plugin JUnit tests from the UI. I can't have a developer be required to go into every single config.ini for every single debug application and add that property every time he wants to debug a new JUnit test.

What I found was that using "Bundle-ClassPath: external:$java.home$/../lib/tools.jar" works like a charm in Equinox dynamically, but fails to compile with PDE statically (at least in the UI).

If I include the above Bundle-ClassPath: in the bundle A and Export-Package: (even though UI marks this export as an error Equinox runtime has no problem resolving), require bundle A from bundle B, DynamicImport-Package:* and run Class.forName("") in bundle B, everything works: EclipseClassLoadingHook.addClassPathEntry kicks in, sees "external:", resolves $java.home$ via BaseStorageHook.substituteVars, tools.jar is found and loaded, class is found, sun shines, birds sing.

However, there is absolutely no way I can compile equivalent code statically, since "external:$java.home$/../lib/tools.jar" is not resolved by PDE the same way Equinox would, and therefore I can't Export-Package: from bundle A, I can't Import-Package: from bundle B and consequently I can't reference statically from a java file - compiler can't find the class files needed.

Is there any way to make the above Bundle-ClassPath work for static compilation? Are there any other ways to achieve what I want?

I'm using Eclipse 3.8.2 and will have to stay on it for a while, until 4.x stops crashing every 15 minutes. I'm ready to implement a required patch myself if someone would be so kind to point me in the direction of a class that deals with PDE bundle class-path resolution in UI and at compile time.
Previous Topic:Show custom marker in custom ruler column
Next Topic:Product generation packages plugins in folder or jar?
Goto Forum:

Current Time: Sat Apr 29 16:13:58 GMT 2017

Powered by FUDForum. Page generated in 0.01505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software