• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Press any key to exit....

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How on earth do I do this With java... System.in.read() is not the answer since it waits on a newline to send the buffer. Basically what I need is a getch() but can't seem to find an equivalent.
[ March 30, 2005: Message edited by: Martin Richard ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would usually just say there really isn't one. Your user will have to hit the enter key.

But I think I saw someone post a workaround. It may have been non-standard or Linux only or something and I didn't copy it into my stash of tips & tricks.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only workaround that I know of is to create your own Console class and redirect System.out and System.in to that.... To me, that always seemed like a lot of extra work when all I needed to do was change my message from "press any key to continue" to "press ENTER to continue". Users don;t really mind (that is, if the users are using a Console-based application at all...)

Any that removes the "Where's the ANY key?" questions
 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic