getResource() doesnt return URL in HP Unix for a valid path

The below code works fine in Windows. But in HP Unix, the URL is always null, though the directory exists.

===========================================================================
Tester x = new Tester();
String xmlPath = args[0];//"../../../../../" + "txn-xml";
String s1 = xmlPath + "/" + "init_record" + "/";
URL url = x.getClass().getClassLoader().getResource(s1);
System.out.println("1. URL is : " + url);
String s2 = "/app/fib/SitNov2008/XLS-ADMIN-SERVER/webapps/FIBSIT01/WEB-INF/txn-xml/init_record/";
url = x.getClass().getClassLoader().getResource(s2);
System.out.println("2. URL is : " + url);
System.out.println("3. FOLDER EXISTS is : "
+ (new java.io.File(s1)).exists());
System.out.println("4. FOLDER EXISTS is : "
+ (new java.io.File(s2)).exists());
===========================================================================

The Output:
1. URL is : null
2. URL is : null
3. FOLDER EXISTS is : true
4. FOLDER EXISTS is : true


Is there anything wrong to get the URL.
Can somebody help on this?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories