File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes executing system command remotely Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "executing system command remotely" Watch "executing system command remotely" New topic
Author

executing system command remotely

Rowan Chattaway
Ranch Hand

Joined: Jan 18, 2002
Posts: 75
Hi,
I'm trying to execute the unix command 'uptime' on a remote production server. This is for an intranet I'm developing. I know I can use:
Runtime runtime = Runtime.getRuntime();
Process process = null;
try
{
process = runtime.exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while((line = in.readLine()) != null)
{
System.out.println(line);
}
}
catch(Exception e)
{
......
this works fine on the local machine, but how would I get a connection to the production server(hosted on a different machine) and run a system specific command from my WebLogic server thorugh an ejb or servlet?
Is the above method I'm suggesting suitable?
can someone give me some advice on how to do this?
[ May 17, 2002: Message edited by: Rowan Chattaway ]

The early bird may get the worm, but the second mouse gets the cheese.........<br /> <br />Sun Certified Programmer for Java 2 Platform<br />Sun Certified Web-Component Developer for J2EE Platform
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: executing system command remotely
 
Similar Threads
Runtime.getRuntime().exec() not printing output
the exec command is not able to deal with space some time
I want to login ( using Telnet ) to a Unix server
Java Runtime command syntax help
list Linux mounted volumes