File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

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

 
murthy bala
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic