Java execution command-line command

Source: Internet
Author: User

Package javai;import Java.io.bufferedreader;import java.io.InputStreamReader; Public classIotest { Public Static voidMain (string[] args) {Try{Process Pro= Runtime.getruntime (). EXEC ("Ping www.baidu.com");            String Line; BufferedReader buf=NewBufferedReader (NewInputStreamReader (Pro.getinputstream ()));  while(line = Buf.readline ())! =NULL) System. out. println (line); } Catch(Exception e) {//TODO auto-generated Catch blockE.printstacktrace (); }    }}


Ping www.a.shifen.com [220.181.111.188] has 32 bytes of data:
Reply from 220.181.111.188: Byte =32 time =28ms ttl=54
Reply from 220.181.111.188: Byte =32 time =28ms ttl=54
Reply from 220.181.111.188: Byte =32 time =28ms ttl=54
Reply from 220.181.111.188: Byte =32 time =28ms ttl=54

Ping Statistics for 220.181.111.188:
Packet: Sent = 4, received = 4, lost = 0 (0% missing),
Estimated time to round trip (in milliseconds):
Shortest = 28ms, longest = 28ms, average = 28ms

Java execution command-line command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.