Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keypressing on console or Dos prompt

 
Antony Amicone
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you worked out how to read input from the console? You can wrap a reader around System.in and readln(). That will require the user to hit the enter key to continue.
 
Christopher Robinson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two choices. For the simple "press enter to continue," you can just read a byte from System.in:However, 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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic