I´m working with application in java. I can execute linux command (bash) on my machine host, but i want to execute this command in a remote machine like ssh. I´m ussing this code
Process process = Runtime.getRuntime().exec(script);
process = Runtime.getRuntime().exec(script);
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
How i can execute linux shell in remote machine with java code?
sshlibrary for Java like the one in this answer: stackoverflow.com/a/996415/4687135. Also, perhaps your script can do the ssh part for you?