*
The moose likes Java in General and the fly likes How to run unix command using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to run unix command using Java" Watch "How to run unix command using Java" New topic
Author

How to run unix command using Java

Manohar Chhapolia
Greenhorn

Joined: Nov 22, 2006
Posts: 17
Hi all,

I have two queries regarding execution of java program on Solaris.

1. Can we run UNIX command using Java and get the output back to Java for the further analysis?
2. Can we run it from one JVM (first UNIX machine) to another JVM (second UNIX machine)? (Actually, I want to run same script on many Solaris and get the out for further analysis)

Thanks and Regards,
Manohar
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 407
    
    1

The answer to 1. is yes and google java class ProcessBuilder similarly google for some examples you'll find a lot of them on the net and they work fine with Solaris though user accounts and shells can be fun ;-)


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

And always remember to read the javaworld article "Why Runtime.exec() doesn't"


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run unix command using Java
 
Similar Threads
Serial Port Ethernet
JVM initializatin error
Loadjava program
C++
writing to a file on remote solaris machine