> URL configFileURL =
> ClassLoader.getSystemResource(configFile);
> but its not reading the system resourse and URL is always null, the
> same code is working for other projects.. what could be the missing
> point..
Presumably the resource is not present on the classpath.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Ian Pilcher - 02 Feb 2006 21:18 GMT
>> URL configFileURL =
>> ClassLoader.getSystemResource(configFile);
[quoted text clipped - 4 lines]
>
> Presumably the resource is not present on the classpath.
Or it is, but the OP is specifying it incorrectly. The documentation
doesn't give much help in this area, but I've found that using a fully
qualified name, *without* a starting slash, works.
For example, if the file I'm after is located at
$CLASSPATH/foo/bar/baz.xml, I'll refer to it as "foo/bar/baz.xml".
HTH

Signature
========================================================================
Ian Pilcher i.pilcher@comcast.net
========================================================================
h4hrr - 02 Feb 2006 23:05 GMT
the file is in the root directory of the project.. and i define it like
private static String configFile = "log.paramters"
still trying to find the cause :-||
Ian Pilcher - 02 Feb 2006 23:48 GMT
> the file is in the root directory of the project.. and i define it like
>
> private static String configFile = "log.paramters"
>
> still trying to find the cause :-||
IIRC, getResource and friends may not work for objects in the root
directory. Try moving it to a subdirectory.

Signature
========================================================================
Ian Pilcher i.pilcher@comcast.net
========================================================================
Nirav - 03 Feb 2006 09:56 GMT
Try loading it with contextClassLoader, it will load resource from root
directory as well.
Nirav Thaker
Thomas Hawtin - 03 Feb 2006 18:23 GMT
> Try loading it with contextClassLoader, it will load resource from root
> directory as well.
Loading from a Class will ensure that the resource is loaded from a path
appropriate to the class. You probably don't need to get involved with
class-loaders directly yourself.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/