Answer the question
In order to leave comments, you need to log in
Why command in bash from IntelliJ Idea (JAVA) is not executed?
Greetings. Working with command line on OS X El Capitan from Java. There are no problems in the code for sure, all sorts of ls, uptime, etc. performed excellently. But netcat or nc is not running. Specifically like this:
p = Runtime.getRuntime().exec("nc -z -v " + host + " " + port);
Answer the question
In order to leave comments, you need to log in
PATH to nc and netcat is correct?
It often happens that /usr/bin or something else is missing.
The simplest check is to write the full path instead of exec("nc -z -v " + host + " " + port), for example exec("/bin/nc -z -v " + host + " " + port)
But on the other hand on the other hand, run nc host port manually - if nothing hangs there, it doesn't output anything, like:
$ nc localhost 8080
$
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question