Name: rlT66838 Date: 07/25/97
Simple test class:
=================================================
package test;
import java.net.URL;
public class test
{
public test()
{
URL url = ClassLoader.getSystemResource("/test/test.gif");
System.out.println("url = " + url);
}
static public void main( String args[] )
{
test t = new test();
}
}
=================================================
I have a file test.gif in the same directory as
test.class. I compile and run:
C:\temp\test>java test.test
url = systemresource:/FILEc:\temp/+//test/test.gif
Now, I put test.class and test.gif into a jar file:
C:\temp\test>cd ..
C:\temp>jar cvf test.jar test\test.class test\test.gif
adding: test/test.class (in=898) (out=516) (deflated 42%)
adding: test/test.gif (in=1077) (out=355) (deflated 67%)
Change my classpath and run the test again:
C:\temp>set classpath=d:\java\jdk1.1\lib\classes.zip;c:\temp\test.jar
C:\temp>java test.test
url = null
======================================================================