Running SSCL scripts from within Java |
SSCL scripts may be processed from within Java code by creating a new SSCL instance and invoking the appropriate execute() method. Scripts may be executed from a file or from an array of bytes. The necessary SSCL classes are located in the SSH Factory sshfactory.jar file.
Example
import com.jscape.sscl.SSCL; import com.jscape.sscl.SSCLException;
import java.io.File;
public class SSCLExample {
public static void main(String[] args) { // create new SSCL instance SSCL sscl = new SSCL();
// load script file File script = new File("c:/script.txt");
// execute script and capture any exceptions try { sscl.execute(script); } catch(SSCLException fe) { fe.printStackTrace(); } } } |