oh. thanks for replying so soon… what, within 20 minutes 
anyway, i deleted the post before i saw your reply.
here’s the original post… and i thought i had fixed it but it didn’t work. your suggestion didnt work either unfortunately.
[quote]hi. i am trying to work out how to access many gif files after they are put into the jar… the gifs are in their own ‘directory’ in the jar file…
eg. using
tempIcon = new ImageIcon(getClass().getResource("cloud.gif"))
allows me to access the cloud file from the root of the jar file, but when i try putting the cloud.gif image into a folder in the jar and use
tempIcon = new ImageIcon(getClass().getResource("tiles/qblock.gif"))
it throws
Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:138) at TileBank.addTile(TileBank.java:92) at TileBank.loadTiles(TileBank.java:40) at TileBank.<init>(TileBank.java:26)
this is after compiling the jar with
jar cvfm BufferStrat.jar MANIFEST.MF *.class *.gif *.java tiles
extracting the jar with WinRar i can run the class file just fine and it loads the images.
code is here… but you have to extract it to run it…
http://members.austarmetro.com.au/~juddman/java/BufferStratBroken.jar
if anyone knows another way to access image files in the jar the program is running from, plz help out. i dont really want to have to dump all the gifs in amongst the class files.
Relevant
public void addTile(String filename, String description,
boolean pl, boolean pr, boolean pu, boolean pd, boolean intr, int index)
{
//tempIcon = new ImageIcon(getClass().getResource(filename)).getImage();
tempIcon = new ImageIcon(getClass().getResource("tiles/cloud.gif")).getImage();
tempImage = gc.createCompatibleImage(32,32,Transparency.BITMASK);
Graphics2D imgGfx = (Graphics2D)tempImage.getGraphics();
imgGfx.setComposite(AlphaComposite.Src);
imgGfx.drawImage(tempIcon,0,0,null);
imgGfx.dispose();
tempTile = new Tile(tempImage, description, pl, pr, pu, pd, intr, index);
tiles[index]=tempTile;
}
[/quote]