This question already has an answer here:
I can't close the IntelliJ IDEA when it hangs, how can I close it from the terminal?
P.S.: I think this question is different from "How to kill a unresponsive program from terminal?" because IntelliJ's process has name just 'java' so you can't really tell it apart by its name.