我想我会发疯的。我尝试了很多东西,但得到了相同的结果。我尝试使用STDINPUT
直接获取输出。我尝试创建一个批处理文件,然后执行FTP。以下是从Windows 7上的命令提示符执行if时发出以下FTP命令的标准输出:
Connected to 172.29.122.77.
220-FTPSERVE IBM FTP CS V1R13 at S0W1.DAL-EBIS.IHOST.COM, 14:47:51 on 2016-05-14.
220 Connection will close if idle for more than 15 minutes.
ftp> user TSSDON2
331 Send password please.
230 TSSDON2 is logged on. Working directory is "TSSDON.".
ftp> quote site filetype=jes
200 SITE command was accepted
ftp> put J1.txt
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-It is known to JES as JOB03525
250 Transfer completed successfully.
ftp: 221 bytes sent in Seconds Kbytes/sec.
ftp> 0.340.65quit
221 Quit command received. Goodbye.
以下是从java程序发出相同命令的输出:
user TSSDON2
quote site filetype=jes
put J1.txt
quit
java程序中的代码如下:
String command = "FTP -n -s:IC" + classCount + ".txt " + ipAddr;
if (trace)
System.out.println("Command issued: " + command);
child = Runtime.getRuntime().exec(command);
child.waitFor();
我试图避免使用像apache这样的java / FTP接口,因为我希望这是一个小项目。