Java is one of the most popular programming languages. The main advantage of Java is the cross-platform capabilities. Probably the most important feature is that it is very different. The code is not compiled like c++ or other compiled languages. In the C++ case, a program that is compiled on windows won’t work on other operating systems. This causes a lot of compatibility issues.
On the other side java code is interpreted on run-time, but as you may think, you need another layer to do the job. This is why Java never works stand alone and you need what it is called a java virtual machine. It is nothing complicated, on Windows is just like any other software you install and forget about it.
Can Java apps to run on the web ? Yes, in fact they are somewhat popular, but it is not the best solution. If you want to run a Java applet on a website you need to have the java virtual machine installed on your computer. You can install it very fast, but if you are a webmaster you can’t assume that all your users have it installed. This is why most webmasters avoid placing Java applets on websites. Other reason is that it is hard for Java applet to interact with other elements on a webpage.