Simulate hardware keystroke in Java without Robot

I currently have a PS1 controller that transfers my Arduino messages to a Java program, which then reads them and presses the correct key using a robot. The problem is that the Robot class cannot send keystrokes for most applications and therefore will not send keystrokes to games that I would like to control using the PS1 controller. How are key presses simulated without using a robot at the hardware level? I previously tried to run Visual Basic Script, and it worked, but was too slow. Is there a way to do this exclusively in java?

+4
source share
1 answer

Java Native Access (JNA) allows you to access the basic levels of operating systems using Pure Java. Here you can access the JNA project here .

In addition, I found a sample that uses JNA to connect to a hardware keyboard to listen for keystrokes. I think this one is what you are looking for.

If this is not what you are looking for, then you can definitely look over the link and implement your own.

0
source

Source: https://habr.com/ru/post/1491361/


All Articles