Input dies after a variable yet short amount of time

Hello, there’s this issue that comes up every once in a while (im talking many months in between each case) while I’m programming in java.

I run my program (which uses input, eg. keyboard and mouse), and everything runs fine but after x amount of time, keyboard input completely dies. The mouse still works, but the keyboard is dead. I didn’t change my code, it’s all identical to the way it was before when it worked, but for some reason, keyboard input just dies.

My physical keyboard isnt the problem because if it was, the mouse would be dead too since the mouse is plugged into the keyboard.

Oh yeah, im using eclispe by the way.

ALSO restarting the computer doesnt fix it

Ah it appears, after hours of debugging and research, that it is an issue with OS X Sierra.

It was (thankfully) addressed by the almighty David Brackeen on his github for his game called “Scared” in which he has made a workaround.

If you dont want to click the link and scroll down to read the reason why it occurs, here you go

"
// macOS Sierra prevents key input after holding certain keys (like ‘e’ or ‘n’)
// because of a native input method popup that isn’t working with Java correctly.
//
// This will still fail is some scenarios, like when pressing a digit after
// holding ‘e’. The digit will not have a keypress event.
//
// Tested on macOS 10.12.0 and Java 8 versions b76 - b101.
// (This may also be happening on older versions of macOS if the
// ApplePressAndHoldEnabled option is set to true - untested at the moment.)
//
// This workaround keeps key input working by allowing the popup to appear,
// but places it offscreen.
//
// Note, input methods are enabled by default.
"
-David Brackeen

Nice, thanks for following through with an update.

At first I thought it had something to do with not de-allocating resource properly – or something.