• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run unix command using Java

 
Manohar Chhapolia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ;-)
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And always remember to read the javaworld article "Why Runtime.exec() doesn't"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic