Nobody is denying the popularity of Javascript. I'm merely pointing out that Java is huge. Java is still incredibly popular in enterprise environments, and so much Java code has been written there that I've called Java the COBOL of the future on several occasions. It's still very easy to find work in Java.
> You can't practically run any language you want on the browser, only one, and it's JavaScript
Everybody knows that, but are you aware of the history of that? Why Javascript is called Javascript, despite not being in any way related to Java?
Java was originally aimed to run in the browser as Aplets. That required a plugin of course, and those have since fallen out of favour for good reason. But Java was originally the language that ran in the browser, and Sun specifically marketed it for that. And then Netscape introduced their own language called Javascript specifically so people would associate it with Java, but it had the advantage that it would run in the browser without the use of plugins. And Netscape was so dominant that they could dictate this sort of thing.
Plenty of Web Aplets have been written at that time, but with browsers abandoning plugins, they've become obsolete. And requiring a plugin before it runs was definitely an obstacle.
Instead Java became the preferred language on the server, and it took a very long time before Javascript got any traction there. It has that traction now, and the advantage of running the same code in browser and server is definitely an advantage, but there's a lot of history before that.
And while Java's popularity is certainly dwindling (and deservedly so, if you ask me), it's coming from an extremely high popularity and has a very long way to go before it's gone. Because it did win almost everywhere outside the browser.