aspose file tools*
The moose likes Linux / UNIX and the fly likes issue when calling shell script from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "issue when calling shell script from java" Watch "issue when calling shell script from java" New topic
Author

issue when calling shell script from java

Murthy Manchala
Greenhorn

Joined: Aug 20, 2008
Posts: 21
From web application we are executing the shell script. shell script will run a stand alone java program.

this program calls another standalone java B to get the connection object.

when we execute shell script on unix its working fine, but when i am firing it from web application its firing the script but at the point of calling B to get the connection object not able to get the connection.

Thanks
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11527
    
100

Is "B" getting executed?


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Murthy Manchala
Greenhorn

Joined: Aug 20, 2008
Posts: 21
first program started executing. then it will call B to get connection object and execute the stored procedures. but its not able to call B. and its not giving any exceptions.

I ran the same sript on unix its working fine.

Thanks
Murthy
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11527
    
100

My guess is that when you run it from within the web application then the path is not set correctly, and so it is not finding java. Do you know how to check your path as an end user and from within the web application?
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Murthy.. a couple of questions.

Where are you running your java program from ? The Unix machine itself or from a remote windows machine ?
Does the library you use to make the connection (if running from windows machine) support proper SCP/SSH functionality ? any logs ?
Can you try giving the absolute path of the shell script in your Java file, rather than relative path, and try executing once again ?
Murthy Manchala
Greenhorn

Joined: Aug 20, 2008
Posts: 21
Andrew,

I don,t know how to check the path in web app. can you please give me sample code.

Thanks
Murthy Manchala
Greenhorn

Joined: Aug 20, 2008
Posts: 21
Dawn,

app server is on Unix box. I am calling the script from from web application. from windows machine when i click the button it will run the shell script. The shell script executes A java programm. A calls B programm to get connection object. I have the class path for all jars in the shell scripts itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: issue when calling shell script from java