Home » Core Java » How to download and install Java plugin in a browser

About Santosh Balgar

Santosh Balgar
He is a Software Engineer working in an industry-leading organization. He has completed his bachelors from Visweswaraya Technological University. In his career, he has worked in designing and implementing various software systems involving Java/J2EE, Spring/ Spring Boot, React JS, JQuery, Hibernate and related database technologies. He loves to share his knowledge and always look forward to learning and explore new technologies. He loves to spend his free time with his family. He enjoys traveling and loves to play cricket.

How to download and install Java plugin in a browser

Java plugins are nothing but the Java Applets. Java Applets are the small Java applications delivered to users in the form of Java byte code. Typically applets are delivered through web browsers. Once applets are downloaded they run in as a separate process from the browser. They can be run in a separate browser frame or Java AppletViewer or standalone test tools.

In this article, I am going to discuss how to download and install Java plugins and how to develop a simple plugin.

This article applies to:

  • Platform: Windows (XP, Vista, 7, 8, 10), Windows Server (2008, 2012)
  • Browsers: Internet Explorer, Google Chrome, Firefox
  • Java Versions: Java-7, Java-8

1. Introduction to Java Plugins

Java applets (Plugins) were introduced in the first version of Java. From early 2010 major browsers started avoiding Java applets because of security constraints and difficulty with the underlying platforms. Java Applets are deprecated in Java 9 and are completely removed from Java 11.

Applets are usually written in Java. However, they can even be written with any other language run on JVM like Jython, Scala, Pascal, JRuby and so on.

Some advantages of Java Applets are as below,

  • They can run much faster compared Javascript
  • Since they run as a separate process on JVM, they get access to all the system resources including hardware
  • Till the canvas support came into existence applets were the favorite to render 3D graphics
  • Cross-platform, once created can be run on any platform

It is important to note that, in modern browsers, Java support has to be enabled manually as Java isn’t enabled by default.

2. Enable Java support in browsers

In this section, we will see how Java can be enabled in various browsers on the Windows platform.

2.1. Internet Explorer

Follow below steps to on/off Java Plugin support in Internet Explorer (I am taking Internet Explorer 8 as an example here)

  1. Click on Tools menu and click on Internet Options
  2. Go to Security tab and click on Custom Levels
  3. In the new popup scroll to Scripting section and enable/disable Java by going to the section Scripting of Java Applets

2.2. Google Chrome

Though latest versions (above version 45) of Google chrome don’t support Java Plugins in older versions to turn on/off Java plugins in Google Chrome follow the below steps,

  1. Click on the wrench icon on the far right of the address bar
  2. On the menu click on Settings
  3. Click on Advanced settings at the end of the Settings menu
  4. Click on Content Settings
  5. Scroll down to Plug-ins and look for Java and click on Disable link to turn on/off the Java plugins

2.3. Mozilla Firefox

In this section, we will see how to enable/disable Java in Mozilla Firefox browser. It is important to note that after September 2018 Firefox isn’t supporting Java plugins. In the earlier versions of Firefox, follow the below steps to enable/disabl2.4. Safarie Java plugins.

  • Click on the little hamburger icon (Tools menu) on the far right next to address bar and choose Add-Ons menu
  • Click on Plugins from the left side menu and scroll down to the bottom
  • Click on Java Applet Plugins to enable/disable Java plugins

2.4. Safari

Follow the below steps to enable/disable Java plugin support,

  • Go to Preferences
  • Click on Security
  • Scroll down to Enable Java. Enable or Disable by clicking on the checkbox

3. Java Plugin Example

In this section, I will show how to write a sample Java Plugin. I am using the IntelliJ Idea editor and in the end, I have attached the complete source code.

3.1. Java plugin lifecycle

  • Init – init() method is to group initialization logic. This method runs first when the applet is run.
  • Start – the start() method runs after the init method and it contains the actual code to run. This method runs each time when the plugin is restored or tabs are switched.
  • Paint – paint() method is used to redraw the applet. This method is invoked after the start method and whenever the browser is refreshed and resized.
  • Stop – this method is automatically called whenever the user moves off the page where the plugin sits. Stop method is called whenver the plugin window is minimized and even when the browser tabs are switched.
  • Destroy – this method is automatically called whenever the browser is shut down normally. This method removes the plugin object from the memory.

3.2. Example program

In this section, I am going to show a basic plugin program that shows the applet lifecycle methods.

package com.jcg.plugin;

import java.applet.Applet;
import java.awt.*;

public class JavaPluginDemo extends Applet {
	//init method is called only once, when the plugin class is initially loaded
    public void init() {
        System.out.println("Plugin initialized");
	//executed immediately after init method. It gets executed each time when the plugin
	//is reloaded, resized and refreshed
    public void start() {
        System.out.println("Plugin execution started");

	//executed whenever the plugin is minimized and user moved to another tab
    public void stop() {
        System.out.println("Plugin execution stopped");

	//redraws the output on the plugin. executed immediately after the start method.
	//executed whenever applet is resized and refreshed
    public void paint(Graphics g) {
        System.out.println("Painting the plugin");
        g.drawString("Painting the applet!!!", 10, 40);

	//executed only once like init method. executed when the applet is closed
    public void destroy() {
        System.out.println("Plugin is bing removed");

Right-click on the program and click run. This launches the applet viewer. Output in the applet viewer is as in the below image,

Java plugin - output
Java Plugin output

Output from the plugin lifecycle methods is as follows,

Java plugin - lifecycle methods output
Plugin lifecycle methods output

In the above output, you can notice that start, paint and stop methods are called multiple times. Whereas, init and destroy are called only once.

3.3. Serving Java Plugins

Plugins can be locally viewed in Applet Viewer. When it has to be served to a remote computer, it has to be served via HTML. Below is the sample HTML snippet to serve Java Plugin,

<appletcode = "JavaPluginDemo.class" width = "300" height = "200"></applet>

<applet/> tag is used to serve the applets.

4. Download Source Code

You can download the full source code of this example here: How to download and install Java plugin in a browser
0 0 vote
Article Rating

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area


Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x