Newbie JAR problem

T

Tom Sanders

Just started learning Java and already have a problem :-(
I have created an applet that animates a few images. Everything works fine
if I use the applet in a HTML page, but if I use the JAR, the images do not
show up. According to the size of the JAR, the images ARE present. If I copy
the images to the same directory as the JAR, everything works fine! All
testing is on the local computer, using Netbeans 4.1 and 1.5 browser plugin.
This is propably a very basic thing that I am not aware of. Please help a
desperate newbie! Thanks!

Tom
 
K

Kroll, Michael

Hello,

Tom said:
Just started learning Java and already have a problem :-(
I have created an applet that animates a few images. Everything works fine
if I use the applet in a HTML page, but if I use the JAR, the images do not
show up. According to the size of the JAR, the images ARE present. If I copy
the images to the same directory as the JAR, everything works fine! All
testing is on the local computer, using Netbeans 4.1 and 1.5 browser plugin.
This is propably a very basic thing that I am not aware of. Please help a
desperate newbie! Thanks!

this is not a NetBeans problem (why do you use not the new Version ?).
I think you don't load the images from classpath !?!
Post some code, so we can take a look a it.
I load it with (very short sample)
getClass().getResource("/gfx/users.gif")


Regards
Michael
 
T

Tom Sanders

Michael,

Thanks for your input. I was using the following code to get the images:

Image scene = new Image;
String filename = "dsc001.jpg";
scene = getImage(getCodeBase, filename);

As I wrote, this works fine with the applet, but not with the JAR. I will
try your approach, see if it makes a difference.

Did not know there was a new version of NetBeans. You get 4.1 if you
download form Sun. Just downloaded 5.0 from the NetBeans site.

Thanks again,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top