Microsoft KB Archive/169798

From BetaArchive Wiki
Knowledge Base

HOWTO: Stop Output Window from Closing After Running Jview.exe

Article ID: 169798

Article Last Modified on 6/14/2006


  • Microsoft Visual J++ 1.0 Standard Edition
  • Microsoft Visual J++ 1.1 Standard Edition

This article was previously published under Q169798


When you run a Java Application using Jview.exe from within the Developer Studio IDE, the MS-DOS Command Prompt Window closes immediately after the Java Application terminates. This article illustrates how to programmatically prevent the MS-DOS Window from closing immediately.


To prevent the MS-DOS Window from closing immediately, you can have an input statement as the last statement in your Java application. For example:

public class Hello1

   public static void main(String args[]) throws
      System.out.println("Hello, World!");;


or alternatively:

public class Hello2

   public static void main(String args[])
      System.out.println("Hello, World!");
      try {; } catch(Exception e) {};


This code causes the Command Prompt window to remain open until you press the enter key. This is a useful because you can see the output during the development of your Java application.

A second option is to run your Java application externally, that is outside of the Developer Studio environment. Open up a DOS command session, and navigate to your project directory. After building the project in the Developer Studio, switch to the DOS window and run Jview.exe with class file containing main as the argument to JView:

JView myClass

Another way of preventing the DOS Window from closing while running the application from within Developer Studio (Visual J++):

  1. Open the project settings.
  2. Select the Debug tab.
  3. Select the stand-alone interpreter category.
  4. Under Windows NT, use WINDIR\system32\cmd.exe as the stand-alone interpreter to run. Under Windows 95 or Windows 98, you need to run in the directory c:\windows\commmand.
  5. Put "/K jview" as the stand-alone interpreter arguments.
  6. Click OK.


For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Keywords: kbhowto KB169798