Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Detect internet Connection using Java

rakeshvrm5Sep 24 2013 — edited Nov 14 2013

i googled      How Detect internet Connection using Java?

and found this code

try {

            Process p1 = java.lang.Runtime.getRuntime().exec("ping www.google.com");

            System.out.println(p1.waitFor());

// return 0(zero) if internet is availble

        }

catch (Exception e)

{

// caught exception

        }

It is working fine in windows.

How change above code so that it works for mac??

Thnax in advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 12 2013
Added on Sep 24 2013
2 comments
502 views