For Programmers: Free Programming Magazines  


Home > Archive > Java Help > July 2004 > Windows environment error while trying to execute 16-bit application using the Runti









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Windows environment error while trying to execute 16-bit application using the Runti
molar

2004-07-28, 9:08 pm

Hi guys,

I'm executing applications in Windows using
process = Runtime.getRuntime().exec(cmd,null,dir);
where cmd[0] is the command e.g. "c:\timeout.exe" and dir is the
working directory e.g. "c:\".

This works fine for 32-bit programs and I can quit them using
process.getErrorStream().close();
process.getInputStream().close();
process.destroy();

However, executing 16-bit applications results in a popup error dialog
box

16 Bit MS-DOS Subsystem
c:\windows\system32\ntvdm.exe
Error while setting up the environment for the application
Choose close to terminate the application

I can change the execution command to
cmd[0] = "cmd.exe"
cmd[1] = "/C"
cmd[2] = "c:\timeout.exe"
and the problem goes away. The problem is process.destroy() kills
cmd.exe not my application!

Does anyone know of a fix for this?

Thanks.
Roedy Green

2004-07-28, 9:08 pm

On 25 Jul 2004 14:03:26 -0700, ben@outram.com (molar) wrote or quoted
:

>I can change the execution command to
>cmd[0] = "cmd.exe"
>cmd[1] = "/C"
>cmd[2] = "c:\timeout.exe"
>and the problem goes away. The problem is process.destroy() kills
>cmd.exe not my application!
>
>Does anyone know of a fix for this?


What would it mean NOT to kill CMD.exe? You would have CMD running
with nothing to run.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Henry Paul

2004-07-28, 9:08 pm

"cmd.exe" in simple terms is an emulator that that makes the program think
it is running in DOS. It also isolates the application in its own memory
space so if it suffers an error it will not crash the entire OS.

When some applications end, you are returned to a command prompt, but not
always. It depends on the program being run. The result of not killing the
cmd.exe process would leave you with a command prompt window open.

To see this in action, go to Start|Run ping 127.0.0.1

The program will run an instance of cmd.exe, run the ping command, and close
the cmd.exe command when finished.

--
Henry Paul


"molar" <ben@outram.com> wrote in message
news:13647f78.0407251303.1de13c9a@posting.google.com...
> Hi guys,
>
> I'm executing applications in Windows using
> process = Runtime.getRuntime().exec(cmd,null,dir);
> where cmd[0] is the command e.g. "c:\timeout.exe" and dir is the
> working directory e.g. "c:\".
>
> This works fine for 32-bit programs and I can quit them using
> process.getErrorStream().close();
> process.getInputStream().close();
> process.destroy();
>
> However, executing 16-bit applications results in a popup error dialog
> box
>
> 16 Bit MS-DOS Subsystem
> c:\windows\system32\ntvdm.exe
> Error while setting up the environment for the application
> Choose close to terminate the application
>
> I can change the execution command to
> cmd[0] = "cmd.exe"
> cmd[1] = "/C"
> cmd[2] = "c:\timeout.exe"
> and the problem goes away. The problem is process.destroy() kills
> cmd.exe not my application!
>
> Does anyone know of a fix for this?
>
> Thanks.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com