The fact is that before the JVM has a chance to optimize the code, the app already restarted by the user unless it is some long running server process.  On the server side, JVM is so heavy, normally there is only 1-2 heavy JVM running for web server and database driver on the entire machine.  On the client side, Java is a joke.  Though users now have more choices: Swing, AWT, JavaFx.  Every one of these is hard to use comparing with C# or Qt.  Most native platform developers hate Java, including OSX developers.