Java: Missing key codes on non-US keyboards

Java does not seem to have key codes for several keys on non-US keyboards. This does not prevent the typed characters from being recognized, but it makes it impossible for the Robot class to simulate pressing these keys.

Examples of missing key codes

On a standard French AZERTY keyboard, 2 keys result in a key code of 0 (unknown key code): The key above the tab which generates the character “²” and the much more important ù% key.

On a German QWERTY keyboard, the ß?\ key and the äÄ,öÖ and üÜ keys are undefined.

You can confirm this using the Java KeyEventDemo:
Percentage key on AZERTY keyboard


Use the Alt Numpad input method.


Adsense referrer spam?

I made a whopping 0,12€ with ads on this blog over the last 30 days (and just disabled them entirely, don’t want to get corrupted by all that money). However, what really caught my attention in the report was a domain that doesn’t belong to me (or my company):

Adsense Referrer Spam

So, apparently t**** used my Adsense code on their site, resulting in a single ad impression (and nobody clicked on it, otherwise, my ad revenue would have been at least three two times bigger). How and why did this happen?

The innocent explanation is that their “Web Back Machine” (which sounds suspiciously similar to the non-profit Wayback Machine) archived one of my pages, including the Adsense ads. That’s possible, but what is more likely it that this is Adsense referrer spam, meant to get me to visit their website. I’ve got to admit that it worked, so now I have to write this blog post to justify my actions to myself, see, it was all in the name of research.

For further information on Adsense referrer spam, let me refer you to this comprehensive, well-written article.