Advertisement

[java] Loading a file from a .jar'ed application

Started by November 24, 2000 01:44 PM
1 comment, last by GKW 24 years, 2 months ago
I need to load a .bmp file from a jared application NOT a jared applet. It works just fine until I jar it then the file loader I made no longer finds the bitmap. I searched sun.com and all I could find was a suggestion that I use getClass().getResource( "mybitmap.bmp" ) but like every one else in the forum all I get is a null URL reference. Any suggestions? I wanrned you! Didn''t I warn you?! That colored chalk was forged by Lucifer himself!
Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
Try /mybitmap.bmp otherwise it append the package name of the class object that you are using.
Advertisement
The problem is that the bitmap is in the jar. It kinda looks like this:

Class Lisa
toothless.crack.whore.Lisa
Hooker.bmp
toothless.crack.whore.pictures.Hooker.bmp

The picture that the class Lisa needs to load is in the jar directory toothless.crack.whore.pictures. I have tried all sorts of combinations of the package with the name of the bitmap but nothing works for the jar. Works just fine outside the jar if I just put the package name infront of the bitmap. If this was an applet I would get the codebase but I don''t know what to do for an application. I thought that having the . in the classpath was supposed to take care of this but I guess not.

I wanrned you! Didn''t I warn you?! That colored chalk was forged by Lucifer himself!

Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson

This topic is closed to new replies.

Advertisement