[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: Trivial OSGi bundle won't run outisde of the IDE
|
Bryan,
The problem is that the "sun.io" package is not exported by any bundle. Usually the System Bundle exports the packages in the base JRE libraries, such as javax.*, org.w3c.*, etc. However since "sun.io" is a non-standard package that is only present on the Sun JVM, it's NOT exported by default. A workaround, as you discovered, is to allow delegation to the boot classpath. You should restrict boot delegation to the package that you're actually using, i.e.:
-Dorg.osgi.framework.bootdelegation=sun.io
The reason this works when you run from the IDE is that Eclipse sets the bootdelegation property to "*", meaning that the boot classpath is always consulted before any bundles. In fact this is very dangerous.
Anyway, the REAL problem is that you're depending on that package! By doing so, you've made your bundle incompatible other JVMs. Is there any way you can write your code so that it uses only standard API?
This highlights an important point when developing OSGi bundles: it's always a good idea to test your bundles on a variety of OSGi implementations (e.g. Felix and Knopflerfish as well as Equinox) and if possible on a variety of JVMs (e.g. Harmony). Just because your bundle runs when launched from Eclipse doesn't mean that it's a valid bundle, unfortunately.
Regards,
Neil