Tuesday, October 7, 2025
HomeLanguagesJavaHow to Install Java Applet Viewer on Linux?

How to Install Java Applet Viewer on Linux?

Applet viewer is a command-line program to run a java applet. It helps you to test an applet before you run it in the browser. The applet’s code gets transferred to the system & then the Java Virtual Machine (JVM) of the browser & executes that code.

In this article, we will look into the process of installing a Java Applet Viewer on Linux.

Installing Java Applet Viewer on Linux:

Follow the below steps to install Java Applet Viewer on Linux:

Step 1: For installing Java Applet Viewer, you need to first download Java JDK 8. Because Java gives applet only up to JDK version 9 only.

Step 2: Open Terminal and execute the below command:

 sudo apt install openjdk-8-jdk openjdk-8-jre 

This command will install Java JDK 8. Or if you already installed it, it will give the following output.

Installing Java Applet Viewer on Linux

Step 3: Write a sample applet code. You can write the following code also. Save it by the name Demo.java in a folder which name is also Java.

Java




import java.awt.*;
import java.applet.*;
 
public class Demo extends Applet
{
  public void init()
  {
        setForeground(Color.white);
        setBackground(Color.blue);
  }
  public void paint(Graphics g)
  {
    g.drawString("Welcome To Java Applet",40,50);
  }
}


Step 4: Write the following commands one by one to execute the applet program.

cd Java/
ls
Demo.class Demo.java
javac Demo.java
appletviewer Demo.java

change directory to the .java file

Step 5: As a result, the program will be executed & give output.

Hence Java Applet Viewer is successfully installed.

RELATED ARTICLES

Most Popular

Dominic
32340 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6709 POSTS0 COMMENTS
Nicole Veronica
11874 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11937 POSTS0 COMMENTS
Shaida Kate Naidoo
6832 POSTS0 COMMENTS
Ted Musemwa
7091 POSTS0 COMMENTS
Thapelo Manthata
6781 POSTS0 COMMENTS
Umr Jansen
6785 POSTS0 COMMENTS