Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] ClassNotFoundException with sun.misc package

Hi Srijith,

The only packages from rt.jar that are automatically available to you
are the ones beginning with "java.". All others, including javax.*,
org.w3c, etc must be imported using a normal Import-Package statement.

All of the standard rt.jar packages (such as javax.*) are exported by
the System Bundle, so your Import will resolve against that. However
the sun.misc package is non-standard so not exported by the System
Bundle.

The best way to resolve this problem is to NOT USE sun.misc, since
that will make your bundle run only on Sun JVMs! There are Base64
encoders available in other libraries, such as Apache Commons Codec.
If you really cannot avoid using the sun.misc package, then you can
add it to the org.osgi.framework.system.packages property, so the
System Bundle exports it.

Regards
Neil

On 5/22/08, Srijith Kochunni <ksrijith@xxxxxxxxxx> wrote:
> Hi All,
>
>       I have a bundle in which i am using sun.misc.BASE64Encoder. However
> when I start my bundle I get a ClassNotFound Exception. I see that the
> sun.misc packages are part of rt.jar and thus am expecting that they should
> be available in the runtime. The exception i get only when I run standalone
> using
>
>    java -jar org.eclipse.osgi_3.2.0.jar -console
>
>  However when I run through eclipse or eclipse.exe using the steps mentioned
> in http://www.eclipse.org/equinox/documents/quickstart.php I do not see this
> error.
>
>  I did a getprop on org.osgi.framework.system.packages, but sun.misc is not
> part of it. I`m not sure of what i`m missing and how i must rectify this.
> Any help in this regard would be greatly appreciated.
>
> P.S: Have also attached the stack trace for the same.
>
> Thanks,
> Srijith
>


Back to the top