-1

i want to execute unix script from java. i am surfed google to get some examples. most of the code is using below class: import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; i am using JDK 8.1 version and unable to find these classes. neither they are available in higher JDK version. can someone help me how to fix this issue?

1 Answers1

1

To execute a script locally you do not need SSH.

You can just treat it as executable (if the executable bit is set for the Java user or group). How to start an executable, please look here (and use a unix path to the script instead of the executable).

If the script is not executable you'll have to call the interpreter for the script and use the script itself as argument.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263