0

It turned out that this question had been asked before.

1
  • By the way, Java 11 and later comes with an HttpClient class. Commented Nov 19, 2020 at 20:15

2 Answers 2

0
Process process = new ProcessBuilder ("/bin/ping", "stackoverflow.com").start ();
BufferedReader reader = new BufferedReader (new InputStreamReader (process.getInputStream ()));
while (true) {
  String line = reader.readLine ();
  if (line == null) break;
  System.out.println (line);
}
Sign up to request clarification or add additional context in comments.

Comments

-1

use the Runtime exec command

Runtime.getRuntime().exec(new String[]{"ping","website"});

https://www.tutorialspoint.com/java/lang/runtime_exec_envp.htm

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.