0
我有問題,該代碼 我用的是CLC(雲fondry)以deplyer雲 我的代碼是在cmd中執行命令的工作,而不是在Java代碼中工作
public class cmd1 {
public static void main(String[] args) throws IOException, InterruptedException {
String[] command =
{
"cmd",
};
Process p = Runtime.getRuntime().exec(command);
new Thread(new SyncPipe(p.getErrorStream(), System.err)).start();
new Thread(new SyncPipe(p.getInputStream(), System.out)).start();
PrintWriter stdin = new PrintWriter(p.getOutputStream());
stdin.println("dir c:\\ /A /Q"); //ca march bien
stdin.println("cf login"); //ca march
stdin.println("[email protected]"); //ici si j'ai fait un login il me demander Email et mot de pass mais il me
// donnée un pb
stdin.println("");
// write any other commands you want here
stdin.close();
int returnCode = p.waitFor();
System.out.println("Return code = " + returnCode);
}
}
應用class SyncPipe implements Runnable {
public SyncPipe(InputStream istrm, OutputStream ostrm) {
istrm_ = istrm;
ostrm_ = ostrm;}
public void run() {
try
{
final byte[] buffer = new byte[1024];
for (int length = 0; (length = istrm_.read(buffer)) != -1;)
{
ostrm_.write(buffer, 0, length);
}
}catch (Exception e)
{
e.printStackTrace();
} } private final OutputStream ostrm_; private final InputStream istrm_;
}
所有命令的是工作,但 如果我使用CF登陸是工作,但認證 不是工作鎖err enter image description here