I am writing an application, which needs to dynamically invoke a class packaged in a WAR file. Now, I was able to invoke classes in a JAR file without problems, but not with a WAR file. A workaround was that, extract the required classes to a Temp directory and invoke them. But when I use Runtime.exec("jar xf a.class"), it is extracting it to the root of the application. I tried using System.setProperty("user.dir", "Temp");, but this also doesn't work. Does anybody know how I can
1. dynamically invoke a class packaged in a WAR? 2. if not possible, extract files to a specific directory?
TIA -Manoj Pooleery.
Joined: Apr 04, 2004
WAR is not the answer
I've heard it takes forever to grow a woman from the ground
You should be able to pass the WAR location to a URLClassLoader and use that ClassLoader to serve the classes. If the Classes are nested in a JAR inside the WAR, You'd have to get a URL to the JAR in the WAR then pass that to the ClassLoader