要做的事情:1.cmd2.在cmd执行cplex3.cplex相关命令Processp=Runtime.getRuntime().exec("cmd.exe/c");这个是1步骤了吗??向执行陆续的cmd命令应该怎么做?????这个是我在cmd里要...
要做的事情:
1.cmd
2.在cmd执行cplex
3.cplex相关命令
Process p = Runtime.getRuntime().exec("cmd.exe /c");
这个是1步骤了吗??
向执行陆续的cmd命令应该怎么做?????
这个是我在cmd里要做的一部分想用java调用
public class TestCMD {
public static void main(String[] args) {
String s = null;
try {
String[] cmds = {"cmd.exe","/k","cplex","D:\\eclipse\\test.lp"};
Process p = Runtime.getRuntime().exec(cmds);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while((s=input.readLine()) != null){
System.out.println(s);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
但是这样一来进入cplex后的命令好像不起作用,只能打出执行cplex后的结果。。。
Welcome to IBM(R) ILOG(R) CPLEX(R) Interactive Optimizer 12.3.0.0
with Simplex, Mixed Integer & Barrier Optimizers
5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55
Copyright IBM Corp. 1988, 2011. All Rights Reserved.
Type 'help' for a list of available commands.
Type 'help' followed by a command name for more
information on commands.
展开