+ 1
Why java programs not run in the web browser?
like html
2 Réponses
+ 3
Because the browser doesn't run Java natively (applets are how that happens, and they're a different experience).
Sites that appear to run Java in the browser, like:
https://code.sololearn.com/#java
...ship your code off to a server (that runs Java), then return the results back to the browser.
For comparison, here are a couple lines from another online Java compiler:
$("#compile").click(function() {
socket.emit('data', 0, "cmd-compile");
Same technique as SoloLearn -> edit on the browser, emit it to the server, display the results when it's done.
+ 1
Java is designed to build Cross platform applications, while html is designed to format a web page. Browsers will run Javascript, this is completely different from java, the two aren't related even though the names are similar.