The Artima Developer Community
Sponsored Link

Java Answers Forum
16 bit exe

4 replies on 1 page. Most recent reply: Jul 21, 2004 7:56 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

16 bit exe Posted: Jul 20, 2004 4:39 AM
Reply to this message Reply
Advertisement
During my application I have to call a external 16 Bit program.

When I try to call it via

Runtime.getRuntime("myfile.exe")

I get the following error message during runtime:

[/i]16-Bit-MS-DOS-Subsystem
C:\WINDOWS\system32\ntvdm.exe
Error creating the environment for the application. Click "close" to exit the application.[/i]

The file works correctly when called from the command line.

I'm using Windows XP Professional (also tried on XP home) SP1 with all avaiable security updates.

btw: I'm using a german Windows system, so I had to translate the error message and it could be a bit different than the message on a english system.

What does ntvdm mean, NT Virtual DOS Machine?


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: 16 bit exe Posted: Jul 20, 2004 7:36 AM
Reply to this message Reply
Big error:

I meant
Runtime.getRuntime().exec("myprogram.exe");


I know the exec() command supports runtime environment settings.
But I wasn's able to find any focumentation for this settings.

Can anyone help me or give me a link with a description of the settings?

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: 16 bit exe Posted: Jul 20, 2004 10:42 AM
Reply to this message Reply
Hmm. I made this little program for experimenting:
public class Executor
{
   public static void main( String [] args ) throws Exception
   {
      String commandLine = join(args, " ");
      System.out.println("Executing \"" + commandLine + "\"" );
      Runtime.getRuntime().exec( commandLine );
   }
   
   private static String join( String [] parts, String separator )
   {
      if( parts == null || parts.length < 1 )
         return "";
      else
      {
         if( separator == null )
            separator = "";
         StringBuffer gestalt = new StringBuffer( parts[0] );
         for( int i = 1; i < parts.length; i++ )
         {
            gestalt.append( separator );
            gestalt.append( parts[ i ] );
         }
         return gestalt.toString();
      }
   }
}


It looks like just trying to run %SystemRoot%\system32\command.com (the 16-bit command interpreter) gets the error you mentioned.

Something similar in Python works just fine:
import os
print 'Running "%s"' % ' '.join(os.sys.argv[1:])
os.system(' '.join(os.sys.argv[1:]))


So I guess it is something with the JVM. I tried running command.com inside cmd.exe and that doesn't do the trick, either...

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: 16 bit exe Posted: Jul 20, 2004 11:09 AM
Reply to this message Reply
I assume you are trying to run a 16-bit console app, because running a 16-bit Windows app doesn't seem to be as difficult.

Trying to do that using "cmd /c", causes cmd.exe to appear in the task list, but no command prompt window to appear, so I'm not sure if it is successfully running the 16-bit console app, but just hiding it.

Anyway, here is something which seems to work:

java Executor c:\windows\system32\cmd.exe /c start 16bitapp.exe

I did this with an old 16-bit COM file and it worked; it just causes it to appear in another window.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: 16 bit exe Posted: Jul 21, 2004 7:56 AM
Reply to this message Reply
"cmd /c start" did the trick, thanks.

Flat View: This topic has 4 replies on 1 page
Topic: WfMS and Jbpm... Previous Topic   Next Topic Topic: applet not running

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use