Before Adobe Flash and other modern Web technologies existed, site owners used Java to create compelling, interactive websites. Like Flash, a Java program plays movies, generates high-quality graphics and supports complex applications that resemble desktop apps. The Java Virtual Machine Interpreter that runs behind the scenes makes it possible for you to enjoy these advantages, but it does have notable disadvantages.
Anatomy of a Java Virtual Machine
The term Java has several meanings; it can refer to the programming language developers use to create applications, the Application Programmer's Interface specification or the Java Virtual Machine specification. When you visit a Web page that has a Java program, also called an applet, your browser activates the Java Virtual Machine that interprets the Java code and runs the applet. Like a real computing machine, the JVM processes instructions and manages memory areas.
Advantage: Java Runs in a Protected Area
Imagine what might happen if a Web page had the ability to delete your files or examine your private documents. Even though Java applets can perform useful tasks that regular HTML code cannot, Java runs isolated inside the Java Virtual Machine. The JVM ensures that a renegade applet from a dangerous site cannot access system resources such as hard drives.
Video of the Day
Disadvantage: Cybercriminals Can Exploit the Java Virtual Machine
Although the JVM restricts an applet's actions, it is still possible for attackers to exploit weaknesses in the Java platform. For example, in early 2013, Microsoft saw three examples of applets designed to use remote code execution to infect computers. Oracle, Java's developer, released an update that keeps you safer by setting applet default security levels to "High." This setting ensures that your browser warns you when an unsigned applet attempts to run. As Microsoft notes, "the vast majority of applets exploiting security vulnerabilities are not signed." A digital signature on an applet lets you know who created it and verify that nobody modified the applet after the creator signed it.
Advantage: One Size Fits All
"Cross platform" refers to a program's ability to run successfully on different types of hardware. Because Java is cross platform, developers can write one piece of code that runs on any PCs, Macs, cell phones and any other device that has a JVM. Java doesn't always have to execute in a browser. You can download Java apps that run on your desktop the way regular programs do.
Disadvantage: Some Assembly May Be Required
If nobody ever installed the Java Runtime Environment on your computer, you can't use Java. Visit the Verify Java Version Web page and follow the instructions to download and install the latest version if you don't have it. Although it's not a lengthy installation, some problems could occur, so consult the Java troubleshooting page if you need assistance getting your installation to work.
At a detailed level, Java Virtual Machines uses its just-in-time compiler to convert Java code into low-level machine language that runs as quickly as regular applications. Since browsers can cache this compiled code, they can reuse it later without downloading it again and going through the compilation steps.