Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Jan 7, 1998

Java and Unix

Question:
Is it possible to use Java to execute a command on Unix and get the output from that command?

Answer:
Yes. The java.lang.Runtime class has various exec() methods that can be used to execute an operating system command. They each reutrn a java.lang.Process instance. The Process class contains the methods getInputStream(), getOutputStream(), and getErrorStream(), which can be used to read and write standard input, output, and error. Look at the example accompanying the question with topic "Piping External Process Output" for more details.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date