File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP Page to call Linux Shell Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Page to call Linux Shell Script" Watch "JSP Page to call Linux Shell Script" New topic

JSP Page to call Linux Shell Script

Michael Lim

Joined: Oct 07, 2002
Posts: 1
What I need to do is to use my JSP page to call a Linux Shell Script which will, in turn, upload files from a local computer to a Linux server. How do I come about this?
Remesh Govind

Joined: Aug 28, 2002
Posts: 8
Runtime rt = Runtime.getRuntime();
if (rt!= null)
rt.exec("/usr/bin/sh path/') ;
// the command

I hope this will hep u .
Remesh govind

Remesh G
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Before we go too far on this I would like to make sure that we both understand what you need and the way JSP works.
JSP code is run on the server, and typically used to dynamically generate HTML for web pages. The JSP code is run before the page is sent to the client browser, and so has no way it can read or write anything on the client system.
Now, have I misunderstood your question? Is your JSP server actually running on what you call the "local computer", and you need to know how to build an HTTP request containing a local file to send to yet another server ?

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: JSP Page to call Linux Shell Script
jQuery in Action, 3rd edition