JDK-4188007 : Difference between 1.1 and 1.2 in calling Runtime.exec from javaw.exe
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1998-11-06
  • Updated: 1998-11-11
  • Resolved: 1998-11-11
Related Reports
Duplicate :  
Description
Run the following program in 1.1.6 and 1.2 with javaw.exe:

	u:/jdk1.1.6/win32/bin/javaw.exe E
	u:/jdk1.2/win32/bin/javaw.exe E

You will notice that 1.1.6 does not create a console window,
whereas 1.2 does.


import java.io.*;
import java.awt.Frame;
import java.awt.event.*;

public class E {
    public static void main(String[] args) throws Exception {
	String java = System.getProperty("java.home") +
	    		  File.separator + "bin" + File.separator + "java";
        String cmd = java + " E$Hello";
        Process p = Runtime.getRuntime().exec(cmd);
	p.waitFor();
    }

    static public class Hello {
	public static void main(String[] args) {
	    Frame frame = new Frame("Hello, world!");
	    
	    WindowListener l = new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
		    System.exit(0);
		}
	    };
	    frame.addWindowListener(l);
	    frame.setSize(200, 200);
	    frame.setLocation(100, 100);
	    frame.setVisible(true);
	}
    }
}

anand.palaniswamy@Eng 1998-11-06

Comments
EVALUATION I'd guess this has been broken in 1.2 for a while now, but never tested. anand.palaniswamy@Eng 1998-11-06 I agree the behavior has been changed. However, I don't think it should be considered as a serious bug. The Runtime.exec() takes only 2 arguments, but the Win32 CreateProcess() takes about 20 arguments. The JLS does not specify the behavior of external process. The new behavior was introduced when fixing other bugs. I believe the new behavior does not violate any spec. I am going to close it as duplicate of 4109888. ###@###.### 1998-11-11
11-11-1998