I'm running Fedora 22 (Linux) and have a Java application written by others that I want to send keystrokes to. I have tried to use xdotool in various ways, but I can neither set focus to the Java app nor send it keystrokes.
The app is started with javaws with the following command line:
javaws -J-XX:MaxPermSize=512M -J-d64 -J-Xms1G -J-Xmx1G /path/to/java/file
My first attempt to send it keystrokes was with this command:
xdotool search --name 'Window title' windowraise windowfocus --sync key H e l l o Return
But nothing happened. The Java window did not gain focus or see my keystrokes.
So I looked up the Java process's PID and tried identifying the process by its PID.
xdotool search --pid 1234 windowraise windowfocus --sync key H e l l o Return
Same result. Finally, I tried identifying the window with 'selectwindow'.
xdotool selectwindow windowraise windowfocus --sync key H e l l o Return
After issuing the command, the cursor changed to a square. I moved the mouse to the Java window and clicked, but this didn't work either.
To investigate further, I ran a different Java application with the following command:
java -jar appname.jar
xdotool could not set focus or send keystrokes to this window either.
Having read the xdotool documentation, I know that some programs won't accept its input. Is there something I can do, such as passing different command line arguments, to these Java apps to get them to listen to xdotool's keystrokes?
Here is some information about the versions of Java and xdotool I'm running:
$ java -version openjdk version "1.8.0_65-debug" OpenJDK Runtime Environment (build 1.8.0_65-debug-b17) OpenJDK 64-Bit Server VM (build 25.65-b01-debug, mixed mode) $ xdotool --version xdotool version 2.20110530.1