DJ_AM_Juicebox
asked on
Some system("pause") equivalent in java?
Hi,
Under win32, I wanted to make a bat file that runs my java application. Right now I have to do something like:
C:\test\java MyApp
but then of course the console window disappears after execution. Is there anyway to keep the console window up until I hit a key to dismiss it? When programming for win32 in C++ I can just use:
system("pause");
Thanks
Under win32, I wanted to make a bat file that runs my java application. Right now I have to do something like:
C:\test\java MyApp
but then of course the console window disappears after execution. Is there anyway to keep the console window up until I hit a key to dismiss it? When programming for win32 in C++ I can just use:
system("pause");
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Little correction:
try {
Thread.sleep(timeInMilisec onds);
} catch (InterruptedException e) {}
try {
Thread.sleep(timeInMilisec
} catch (InterruptedException e) {}
you can have a Thread.sleep of(5000)
so that it waits for 5 sec..
you can increase the value
so that it waits for 5 sec..
you can increase the value
You can simply add 'pause' to your bat file.
C:\test\java MyApp
pause
C:\test\java MyApp
pause
theres no way to achieve that, best you can do is pause until user hits enter key using
System.in.read();
System.in.read();
(already mentioned that)
you comment was wrong, and won't achieved what has been asked.
stdin is buffered so as I mentioned above the best you can do is pause until enter is pressed.
System.out.println("Please press Enter to terminate...");
System.in.read();
DJ_AM_Juicebox,
Let me know if you have any questions :)
stdin is buffered so as I mentioned above the best you can do is pause until enter is pressed.
System.out.println("Please
System.in.read();
DJ_AM_Juicebox,
Let me know if you have any questions :)
>>you comment was wrong, and won't achieved what has been asked.
Strange that you repeated it then ... ;-)
Strange that you repeated it then ... ;-)
:)
:-)
try {
Thread.sleep(timeInMilisec
} catch (InterruptedException) {}
If you want to pause for some time.