-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.8
-
x86
-
windows_nt
Name: krT82822 Date: 06/20/99
0. environment
6/20/99 kevin.ryan@eng -- from the command line, the "net start" command seems to write to normal stdout/err, and does not create a separate
window. However, even if you trap both stdout and stderr coming back from that process when exec()'d from Java, you get the extra DOS window
under JDK 1.1.8. Not clear where this output is really going, or why this window is getting created. FIling bug only FYI.
------------------------------------------
JDK 1.1.8 (tried 1.1.6, too)
Windows NT 4.0 Server + Service Pack 4 (Japanese version, though)
1.
Invoking Windows' net command makes another DOS prompt though I want it put
its result to the same window. I can't see the difference to other commmand
like cmd.exe.
The same code works well with Java2.
2. source for reproduction
------------------------------------------------------------------
import java.io.InputStream;
public class SimpleInvoker {
public static void main(String[] args) throws Exception {
Process p =
// [all these work. callee's output is sent to the same DOS window]
// Runtime.getRuntime().exec("c:\\winnt\\system32\\tree.com");
// Runtime.getRuntime().exec("c:\\winnt\\system32\\ping.exe");
// Runtime.getRuntime().exec("c:\\winnt\\system32\\cmd.exe /c dir");
// [but this doesn't work in JDK1.1.6 and 1.1.8]
// [works well with Java2. no popup window]
Runtime.getRuntime().exec("c:\\winnt\\system32\\net.exe start");
InputStream in = p.getInputStream();
int len;
byte[] data = new byte[512];
while( (len = in.read(data)) > 0){
System.out.write(data, 0, len);
}
}
}
------------------------------------------------------------------
3. On JDK1.1.8, new popup DOS prompt is made but nothing come to the
InputStream.
On Java2, the result of the "net start" is shown on the same DOS
prompt. Like below,
-----------------------------------------------------------
D:\JavaStorage\aki\application\callVBS>java SimpleInvoker
These Windows NT services are started:
Alerter
Computer Browser
(omit. all working NT services)
Workstation
World Wide Web Publishing Service
The command completed successfully.
-----------------------------------------------------------
5.
C:\>\jdk1.1.8\bin\java.exe -version
java version "1.1.8"
C:\>\jdk1.1.8\bin\java.exe -fullversion
java full version "JDK1.1.8M"
(Review ID: 84574)
======================================================================
- duplicates
-
JDK-4109888 (process spec) Semantics of external process is not defined in JLS
- Closed