Download and import the jar from this link to be able to call native C functions from java.
https://github.com/java-native-access/jna
Only tested on ubuntu 20.04 and you will need xdotool installed.
sudo apt install xdotool
Directions NORTH=0 EAST=1 SOUTH=2 WEST=3
NameStruct = X - 0x10