First off, HTML is not a programming language, it is a static formatting language. JavaScript is not a programming language either, it is a (client-side or server-side) scripting language. Now, HTML usually acts as some sort of container within which you can include other things like Java
applets, Flash animations, etc. If you are going to write HTML pages, your website will be static, that means the content of your pages have to be updated "by hand". If you want your web pages to provide dynamic content, then you can use JavaServer Pages And Java
Servlets, or ASP or PHP or whatever server-side technology that may generate dynamic HTML content. Besides Java applets, Java is not present as such in a web page, but a web page may the product of some server-side page generation.
Now, as for choosing a specific technology for implementing web applications, Java is very well-suited for that purpose but it is not the only technology at hand. Also it depends on what kind of application you want to do.