Dynamic Class Loading "THIS IS A TOUGH ONE"
Posted on 2004-08-23
My application is deployed in a jar file. During startup, the app needs to locate this jar file or the root directory to where it was extracted. I will spare you the details as to why we do this.
The way we do this is by getting the ClassLoader object of a regular class found in the jar file. We then use the getResource() method of the ClassLoader object in order to get the absolute path of the class. From this path, we can extract the absolute path of the jar file or the root of where the jar file was extracted.
However, in this certain environment, I am not getting the absolute path when calling getResource(). Instead I get this:
where the /com is the first directory in the package structure found in the jar file.
The environment is Oracle 9i application server, Linux OS with German locale.
Can anyone tell me why getResource() doesn't give me the absolute path of the loaded class? It works fine with all of environments.