Disable shell window on win32 when running external command line programs

Ranjit Mathew rmathew@hotmail.com
Mon Jun 9 09:39:00 GMT 2003


> as up to now I was (due to this mailinglist) able to disable gcj-swt-apps 
> showing a console window when started using -mwindows at link-time
> 
> but if I now start an external command line program (in this case cdrecord) 
> using
> 
> Runtime.getRuntime().exec("cdrecord --scanbus");
> 
> there pops up a command line window - which is not the case when using the sun 
> jre

This problem is also there for a GUI application when it
encounters an exception (as GCJ spawns addr2line and c++filt).


> How can I disable this?

I'm not 100% sure, but quite possibly, modifying the
CreateProcess( ) call in java/lang/natWin32Process.cc
like the following should help:

      if (CreateProcess (NULL,
                         cmdLine,
                         NULL,
                         NULL,
                         1,
-                        0,
+                        CREATE_NO_WINDOW,
                         env,
                         wdir,
                         &si,
                         &pi) == 0)

However, it seems that this would not work on Win9x/ME
and for 16-bit MSDOS apps (according to MSDN).

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/




More information about the Java mailing list