You can definitely write games in Java.
Here's a nice 2D game that uses only standard Java class library and has been open-sourced.
https://github.com/BlkStormy/epic-inventor
If I had to write a Java game, I'd look into using Maven for building it and some sort of logging framework at least. And probably one of the gaming frameworks like libGDX if graphics got more advanced...