i guess you can put an if statement in you code that tests the command line args to see if == "exit", then call something like System.exit(0)

you could also then write a line following this that calls a batch program which executes close command for DOS window. (can you write MS DOS scripts?) [ November 15, 2005: Message edited by: kwame Iwegbue ]

As fas as Java is concerned, there is no DOS window. Too often, I see the obscuring of the Java platform alongside some other platform. It is important to acknowledge that you're using the Java platform, not DOS, not Windows, not Linux, not anything, but Java.

If you look at your code, you'll see that you're conforming to an API Specification. For example, you're reading data in from the standard input stream and probably writing data out to the standard output stream. That this data appears as a DOS window to you, at some given point in time, has nothing at all to do with the Java platform, since it knows only of the standard input stream and the standard output stream (or more accurately, what the API spec. says).

Unfortunately, there are some corner cases where Java "leaks" its abstraction to the underlying platform, but not for this case.

If you don't want a command window to appear, start your program with "javaw" instead of "java", i.e. create a shortcut on your desktop and use "%JAVA_HOME%\bin\javaw.exe MyClassName" as the target to execute.