Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem loading a properties file

843807Nov 2 2007 — edited Dec 11 2007
I am developing an applet and I want to use a properties file in order to have some configuration data embeded
I have packaged everything in a jar file
The code I have written in the applet's init method to implement this requirement is this:

ClassLoader cl=this.getClass().getClassLoader();
InputStream is=cl.getResourceAsStream("/geom/def/base/premarc.properties");

I have also tried calling getResourceAsStream from the Class object, instead of the ClassLoader object with the same result.
In the HTML file, I have put the APPLET tag with the ARCHIVE and CODEBASE attibutes pointing to the jar file. The value is correct since I can see in the Java console my System.out instructions

The result I am getting is that the InputStream returned by getResourceAsStream is always null

Anybody could tell me what I'm doing wrong?

Thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2008
Added on Nov 2 2007
3 comments
175 views