Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3607766
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:25:03+00:00 2026-05-18T21:25:03+00:00

I have a console program written in Java that should respond to single key

  • 0

I have a console program written in Java that should respond to single key presses, but the user does not press enter.

I’m making pong.. so need the up and down keys to move the bat thing.

Alternative approaches welcome! (apart from making a GUI instead)

— Edit:

I’m only going to run my program on UNIX systems (OSX and Linux), so I think I can put the terminal into “raw” mode with this: stty raw

When I type that into the console before running the program it works! But I need Java to do it automatically, so I tried this:

Runtime.getRuntime().exec("stty raw");

and it does nothing… probably because the JVM is just running it as a separate process and not as a process within this terminal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:25:03+00:00Added an answer on May 18, 2026 at 9:25 pm

    I think you can’t without native code and JNI. Take a look at Java Curses library:
    http://sourceforge.net/projects/javacurses/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a console program written in C# that I am using to send
Question: I have written a console program that uses the SQL server 2005 web
I have a little c# console program that outputs some text using Console.WriteLine. I
I have a C#/.NET program that can run both as a console application and
I have a console app that needs to display the state of items, but
i have written a java program which currently runs as a desktop app, it
I have written the java code below, which executes another java program named Newsworthy_RB.
I have a console application that will be kicked off with a scheduler. If
I have a console application that require to use some code that need administrator
I have a console application project in C# 2.0 that needs to write something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.