jtopenlite.com.ibm.jtopenlite.samples.CallCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400-jdk9 Show documentation
Show all versions of jt400-jdk9 Show documentation
The Open Source version of the IBM Toolbox for Java
package com.ibm.jtopenlite.samples;
import com.ibm.jtopenlite.command.*;
/**
* Sample program that uses JTOpenLite to call a command on an IBM i server.
*
* @see com.ibm.jtopenlite.command.CommandConnection
*/
public class CallCommand {
public static void main(String args[]) {
try {
String system = args[0];
String userid = args[1];
String password = args[2];
String command;
CommandConnection connection = CommandConnection.getConnection(
system, userid, password);
System.out.println("Info: The NLV of the connection is "
+ connection.getNLV());
for (int i = 3; i < args.length; i++) {
command = args[i];
System.out.println("Executing: " + command);
CommandResult result = connection.execute(command);
System.out.println(result);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy