Forums Register Login

Calling a Java Class in a WebArchive from an external shell script

+Pie Number of slices to send: Send
All,

I need to call a class packaged in my web application from a shell script to pass an argument to the class. To be more specific, the packaged web archive (WAR) will be deployed in an application server and after its deployed i need to call that particular class present in the WAR file on a continuous basis and pass an argument.

Example: Target class file's directory location in the WAR file - WEB-INF/Classes/com/sample/batch/invokeBatch.java

and i need to call this java file from a shell script from my unix home directory and pass it an argument like

./calljob.sh $java_argument

Can anyone suggest how to proceed further on this. Where can i start from to work on the solution?
+Pie Number of slices to send: Send
The "calljob.sh" script invokes the "java" command, correct? If so, you can set up the CLASSPATH variable in the script any way you like, maybe like this:

WEBAPP_PATH=/full/path/to/the/webapp/WEB-INF

CLASSPATH=$WEBAPP_PATH/classes:$WEBAPP_PATH/lib/some-extra-library.jar

java -classpath $CLASSPATH my.package.hierarchy.MyClass $1
+Pie Number of slices to send: Send
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


Reply locked
This thread has been viewed 1856 times.
Similar Threads
help me with specify properties file please
Problem accessing classes from /WEB-INF/classes directory
Reading class files from a war
JSP Compilation doubt
Unix Shell Script to archive file with time bound - random access file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:39:33.