aspose file tools
The moose likes Java in General and the fly likes Classloading, WAR file extraction Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Classloading, WAR file extraction" Watch "Classloading, WAR file extraction" New topic
Author

Classloading, WAR file extraction

Manoj Pooleery
Ranch Hand

Joined: Sep 20, 2000
Posts: 35
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.
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
WAR is not the answer


I've heard it takes forever to grow a woman from the ground
Manoj Pooleery
Ranch Hand

Joined: Sep 20, 2000
Posts: 35
WAR is not the answer

What exactly do you mean by this?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Maybe.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classloading, WAR file extraction
 
Similar Threads
Import a non-packaged class??
importing a package which is in different application
How to Extracting a *.war via "jar -xf" to another directory
Serving from temp or other directory?
Problem accessing classes from /WEB-INF/classes directory