View Single Post
  #8 (permalink)  
Old 12-07-2007, 07:38 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
You'll have to experiment with the path until you get it figured out. If the class file is in folder "core" and the image files are in folder "images" and both folders are on the same level in their parent directory/folder "Thez" you could try
../images/test.jpg
in a File constructor. The "../" part moves you up to the parent folder.
The getResource method requires that the resource be in/on the classpath which means that
C:\Documents\Thez
should be part of your classpath environment variable. You can check this environment variable with
set classpath
at the prompt.
If you do have the images in/on the class path then you can experiment with
Code:
String path_to_try = ... URL url = getClass().getReaource(path_to_try); System.out.println("url = " + url.getPath());
to see what the jvm is retuning for a given path.
Reply With Quote