File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Runtime.exec(unix command) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Runtime.exec(unix command)" Watch "Runtime.exec(unix command)" New topic
Author

Runtime.exec(unix command)

Ernst Sternmann
Greenhorn

Joined: Dec 05, 2003
Posts: 2
i've a problem tryin to run exec on a jsp, i tryed using java files and jsp and both doesnt work. the source its!
mport java.io.*;
public class exec
{
public static void main(String[]argv)
{
try
{
Runtime rt = Runtime.getRuntime();
Process prcess = rt.exec("/bin/sh","-c","/APPS/webcust/car/docs/me/apis/charlie.sh");
}
catch (Exception e){}
}
}
any idea about whats the problem or sugestion to execute the same on a simple JSP file?
thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

What does this script do? What error are you getting?
If the script outputs anything, you need to explicitly handle the output.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ernst Sternmann
Greenhorn

Joined: Dec 05, 2003
Posts: 2
the sh file its just a test, it creates a txt file with the date, thats all, but its the first step before the real one (execute a c program, who execute various programs and updates on 4 db's, etc).
i dont recipe any error msg, just the sime HTTP 500 Internal Server Error
The page cannot be displayed
thanks
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
I'm somewhat puzzled that the source you show is definately not a JSP - it's just a regular Java command-line class. If you are expecting a server to execute this file you are likely to be disappointed.
Do you have any other working jsp files to look at?


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1

Thats just super - you throw away the anquished cries of the Java Runtime as it attempts to communicate with you.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

Ernst,
It creates a text file and puts it where?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Runtime.exec(unix command)
 
Similar Threads
Custom tags - problem getting started
java.lang.reflect.InvocationTargetException
Error while Generating wsdl from wsgen tool
bean - servlet communication
Error: Invalid jsp:include Tag