Forums Register Login

keep cmd window open after System.exit(0) (.bat file)

+Pie Number of slices to send: Send
Hello,

I made a program and I run it with a .bat file.
This works fine but if my program crashes and it does a System.exit(0) the cmd screen closes at once.
I can't read the exception message thats printed on the cmd.
How can I make sure the cmd stays open?

I already tried running with java instead of javaw, that doenst solve the problem.

Regards,

Jorg Klein
+Pie Number of slices to send: Send
Open a command window and then run the .bat file from there.
+Pie Number of slices to send: Send
 

Originally posted by Joanne Neal:
Open a command window and then run the .bat file from there.



I also already tried that but the .bat file was not visible from the command window for some strange reason.
If I looked in the dir with dir/p or dir I did not see my .bat file, very strange
+Pie Number of slices to send: Send
 

Originally posted by Jorg Klein:

I also already tried that but the .bat file was not visible from the command window for some strange reason.
If I looked in the dir with dir/p or dir I did not see my .bat file, very strange



That is incredibly strange... Maybe you were in the wrong location.


Anyway, another option is to have your batch file start yet another command window -- one that will stay around. In your batch file, do something like...

cmd /k java ...

Henry
+Pie Number of slices to send: Send
finally, that works Henry!

start "ApplicationName" cmd /k "%JAVA_HOME%/bin/java" -cp .....

that works!!
thanks a lot!
I searched a long time for a solution!
+Pie Number of slices to send: Send
You can use the "pause" command to block a bat file and optionally display a message like "Hit any key to continue, any other key to quit."

Hmmm, just tried it an it doesn't take an optional message. Maybe that was OS/2.
[ March 03, 2006: Message edited by: Stan James ]
Yes, my master! Here is the tiny ad you asked for:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 8024 times.
Similar Threads
Opening .jar from .bat shortcut...
Send answer to my dout ie difference b/w System.exit(0) and System.exit(1)
another question about exec() to open a cmd window
Screen capture of web page?
Weblogic on Win 98
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:00:28.