Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resource URLs broken in JWS



Nick Howes wrote:

Thanks for the response.  Bino's workaround doesn't seem to apply to
my code.  I use getResource() in a few places, but they are all of
the form:

rslt = Toolbox.class.getClassLoader().getResource(name);

Unless there's some subtlety about using the ClassLoader instead of
delegating via the Class?

There is a subtlety about this when using WebStart. JWS uses its own ClassLoader instance to load classes from the resource JARs, and the default loader to load the Toolbox (and other classes from the BOOTCLASSPATH). This may account for the problem. When the resource bundle is in a JNLP resource JARs, you should use the JWS ClassLoader to fetch them. To do this, use one of your own classes instead of Toolbox, obtain its class loader, and use that to fetch the resource:


    rslt = this.getClass().getClassLoader().getResource(name);

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.