File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JNLP and Web Start and the fly likes Loading a resource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Loading a resource" Watch "Loading a resource" New topic

Loading a resource

John Sutt
Ranch Hand

Joined: Mar 07, 2008
Posts: 42
Dear all,

In the root of my project I have a "resources" folder which, among other things, has a few .properties files.
These files are moved into the root of the .jar file, which I export from this project.

In my code, i read these properties as follows:

I'm not using the following, because, if I understand correctly, this searches relative to the MyClass class,
and hence will not find the file in the root of the .jar file.

Anyways, both of the above URLs were null when started with Java Web Start. I decided to print the classpath,
like this:

The result was

I was suprised not to see my myJar.jar file in here. Is that the reason it fails? And how can I make sure myJar.jar file is in the classpath?

This is in my .jnlp file:

I thought that would be enough to put myJar.jar in the classpath, but apparantly not?
Hope somebody can help me,

SCJP 6 (91%), SCJD (91%)
John Sutt
Ranch Hand

Joined: Mar 07, 2008
Posts: 42
The following does seem to work...

I wonder though, why the following, which I also tried, did not work then?

I agree. Here's the link:
subject: Loading a resource
It's not a secret anymore!