Hi, I have a situation where I'd like to use classes without having to compile them into my program (they may be created afterward). My program knows the superclass, so I am creating them with Class.forName and invoking the constructor then casting the resulting object.

However, simply giving the class name as a string doesn't tell my program how to actually find the classes. I thought of uncompressing the jar file, adding the classes to the manifest and then recompressing the jar file, which is better than having to recompile, but I'd prefer something simpler, like editing a file outside of the jar.

Is there a simple way to do this?

08-02-2007, 12:33 AM

brianhks

As long as the classes are in the class path your good to go. You could put your classes in one jar and then the others that come later you could put in a second jar file. As long as both are in the classpath when your program starts everything should be good.

You could also use the Class-Path: option in your manifest to include the other jar as well.