JAVA Applet

JAVA Applet

JAVA Applet [1] is a special Java program that is embedded inside the webpage and is executed within a Java Virtual Machine (JVM) in a process separate from web browser. It enables Web pages to contain animated graphics or interactive content.

Creating a Java Applet

Copy the directory javaApplet from /usr/local/doc/JAVA

cp -r /usr/local/doc/JAVA/javaApplet .

You can find the java file "userAction.java" and the html file "userAction.html". The java executable or applet (userAction.class) is embedded in the html file which is being created. Also, in the java file, we are importing JAVA Applet libraries via "import java.applet"

Request a compute node:

srun --pty bash

cd to the javaApplet directory and compile the java code

javac userAction.java

This will create a userAction.class in the same location.

Running Java Applet

(Note: This is just the information to execute it in your server as an admin)

Transfer the files userAction.class and userAction.html to your server. In the example, it has been copied in  /var/www/html/javaApplet/ in hpcmgmt.

In the browser, type the link to the html file. In the example, type: https://hpcmgmt.case.edu/html/javaApplet/userAction.html

You should be able to see the session as showed below and interact typing and changing the color of the text.