Posted on 2006-06-13
OK, i have 2 jars, call them A.jar and B.jar
A.jar's purpose is to synchronize B.jar with some version of B.jar on the network in a specified location. If A.jar discovers that B.jar is out of synch with this other version, it replaces B.jar with the one on the network. Also, if B.jar is not present in the current directory it replaces it with B.jar from the network spot. Both A.jar and B.jar live in the same directory.
Now, i exectute like this: java -classpath A.jar;B.jar someClass someparameter
However, I've found that when I do it this way, if B.jar is NOT originally in that directory when I launch Java it cannot find any classes in B.jar even if I copy it to the directory before I try to execute them.
Does that makes sense? let me clarify:
I start with A.jar ONLY in the directory. A.jar's job is to check for B.jar and when it does not find B.jar, it copies B.jar from a place on the network. It then needs to launch a class from B.jar in a thread and exit.
However, when either B.jar is not originally in the directory OR if B.jar is replaced by A.jar, the JVM throws a ClassDefNotFoundException for the class I'm trying to execute. If B.jar is not touched (its there AND its up to date), the launch works fine.
Any ideas? Thanks!