In my "app.war", it includes WEB-INF/classes/Servlet.class, Standalone.class, Action.class, etc.
The Standalone.class is a simple java application that uses some other Action.class included in the WEB-INF/classes/ dir.
Now, if I give somebody this "app.war" and they just want to run "Standalone.class", here are the questions ---
1. if they simply add "app.war" into their classpath, can you run "Standalone.class" at any directory ?
2. if they only deploy "app.war" to their application server WITHOUT adding it to the classpath, can they run he "Standalone.class" ?
thanks.
Rovas Kram
Ranch Hand
Joined: Aug 08, 2003
Posts: 135
posted
0
1) Adding to the classpath is not going to work because the path part of the is incorrect. I'm sure your package name doesn't start with WIN-INF for example. 2) Adding the classes to WEB-INF/classes will make them available to any classes that are loaded at the web-app level: servlets, jsp, classes in WEB-INF/lib. At least that's the way it works in Weblogic.
Frank Sikuluzu
Ranch Hand
Joined: Dec 16, 2003
Posts: 116
posted
0
Thanks Rovus. I understand your answer to the first question. But for the second question, what I want to know was --
I only add "app.war" into the application server's deployment directory. And the server does NOT expand this WAR file into a hierachy directory structure, i.e. you will not see those .class files in WEB-INF/classes. If this is the case, then can the user run "Standalone.class" either within or outside the web application directory ?
Rovas Kram
Ranch Hand
Joined: Aug 08, 2003
Posts: 135
posted
0
I don't think it matters whether or not it's expanded. The classes that are in the WEB-INF/classes or WEB-INF/lib directories will only be available among themselves(e.g. to classes in WEB-INF...). For example a classpath that was loaded from the system classpath will not have access to any of the classes in WEB-INF.
Peter Bell
Greenhorn
Joined: Mar 25, 2003
Posts: 19
posted
0
How about you put your classes in a jar file. Then add the jar file to /WEB-INF/lib/ in the war file. Then distribute the jar file when people would need to run things standalone?