File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Keypressing on console or Dos prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Keypressing on console or Dos prompt" Watch "Keypressing on console or Dos prompt" New topic

Keypressing on console or Dos prompt

Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
anyone remember the Dos prompt and the inscription "Press enter to continue... "

so... i want to control the pressing of the button "Enter" on Dos Prompt. How to do this.
It's pretty easy to do this on a JFrame, but how to do it on dos or console?
Kamesh Loganathan

Joined: Jan 21, 2006
Posts: 20
Hi Pal,
I think the best way to do this is using win32 API's.
If you are bent on using java, write a dll and call it
from java.
Antony Amicone
Ranch Hand

Joined: Mar 11, 2006
Posts: 125
i'm a beginner is really too difficoult this to me. Is there a simplest way? i only need to make and if that control if enter is pressed on console or dos prompt
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Have you worked out how to read input from the console? You can wrap a reader around and readln(). That will require the user to hit the enter key to continue.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Christopher Robinson

Joined: Apr 15, 2006
Posts: 7
Two choices. For the simple "press enter to continue," you can just read a byte from, for more complicated stuff, I'm lead to believe there's a Java-based ncurses implementation. I don't know if this will include support for DOS terminals.

I agree. Here's the link:
subject: Keypressing on console or Dos prompt
It's not a secret anymore!