Java getResource problems

Anybody know why Domino can’t seem to find resources inside of .jar files that I add to the “Project” within a Java agent or library?

I’m guessing it has something to do with the fact that since these are not on the filesystem, they have to be “detached” to a temp folder somewhere before loading in the JVM.

Anyway, no mater what I do I can’t seem to get file resources that are inside the jar. I’ve tried getting files from the jar root, and from within packages and folders inside the jar. I’ve tried getting at them from code within the jar and from code typed into the agent. Nothing seems to work.

And of course all this code works fine when run inside eclipse (but of course there it is running from a static location).

I plan to put more time into figuring this out, but just in case someone can save tme the time I thought I’d ask here.

Subject: Java getResource problems

It really helps u!

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/a4db61e79e9356dd852570bb005607ff?OpenDocument

Subject: Me too: Java getResource problems

David,

Have you had any luck? I also have the same problem and have been trying to tweak java.policy, move jar files from jvm/lib/ext, move properties files out of the jar and into the agent project, etc but nothing works. The call to getResource() always returns “null”

For my testing I have a jar file with a single Class and properties file in the same package name. My Java agent instantiates the class and executes the following code:

Class clazz = ChartTest.class;

URL url = clazz.getResource(“jcommon.properties”);

if (url == null) System.out.println("URL is null: " + url);

This is an attempt to locate the problem using JFreeChart I have posted here: http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/408d5bd66150251b85257103005ebe34?OpenDocument

It seems difficult finding anyone who has indepth kowledge of how Lotus have coded their JVM for agents.

  • I’m also confused as to whether the call to getClassLoader() is also a problem for agents

Brad

Subject: RE: Me too: Java getResource problems

No luck yet. I haven’t made time to work on it really. I’ve just put the files I need somewhere static, which I don’t like.

We just need to figure out if there’s any way to tell where the code runs from (where Domino “detaches” the project files to the first time the agent is called).

  • David