Hi,
i am having the problem of accessing resources from the jar file. Here is a test class that i wrote to access conf.properties located in the jar. I tried the ones suggested in the other 'Threads' in this forum but still having the same problem.
*******************************************************
package test;
public class Test{
public static void main(String args[]){
Test t1 = new Test();
java.net.URL url =t1.getClass().getResource("conf.properties");
if(url == null)
System.out.println("could'nt find the resource");
else
System.out.println("Yes..got it..."+url.toString());
}
}
********************************************************
I have conf.properties in the test directory i.e., same directory as the 'test' class.
Here is the output when i compile and create a jar file.
E:\projects\classes>jar cvf test.jar test
added manifest
adding: test/(in = 0) (out= 0)(stored 0%)
adding: test/dp.properties(in = 24) (out= 17)(deflated 29%)
adding: test/test.class(in = 784) (out= 470)(deflated 40%)
I get the following output.
Yes..got it...jar:file:/E:/projects/classes/test2.jar!/conf.properties
When i load this properties file i get a FileNotFoundException.
Whats up with the url string that i get from the getResource() method. Looks fishy to me...
Any help is greatly appriciated.
Thanks,-PC RE