R
R
reus2017-07-07 12:06:03
Java
reus, 2017-07-07 12:06:03

How to implement key tapping in a console application?

Hello, the task arose to implement in a console application (without gui) in Java for windows a keystroke listener and events for it.
The meaning of the task is that after launching the console application, if the user presses Esc, the application will exit.
I googled but didn't find a way to implement this (at least without a gui). Apparently we need a native lib under win.
Maybe someone faced a similar problem?
PS. it is necessary to catch pressing Esc, not Enter and so on.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2017-07-07
@chupasaurus

JNA KeyHook example , have fun.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question