views:

10

answers:

0

I have create one utility which reads all files stored in the directory on classpath. The directory location is configurable through properties file. When I am trying to read the directory location using

URL url = XXX.class.getClassLoader().getResource("com/abc"); //abc is directory on classpath.
URI uri = url.toURI(); //This fails with IBM websphere 6.1 but works on JBoss with Sun SDK
File dir = new File(uri)

I get an exception if above code is executed on IBM websphere but the same code works on JBoss with Sun SDK. (Exception as URISyntaxException - Illegal character in pat at index)

The IBM websphere server is installed in "C:\Program Files" and the index is indicating error at " "(space)

Can anyone let me know, how can I read directory which is on classpath without running into problems listed above? OR what change I need to make in above program so that it wont fail.