# Background

The DSA course in this term provided some visualization programs for understanding data structures and algorithms. However, all of them are applet programs. Applet can run with proper JAVA environment simply in browsers in the past, but they are not supported by modern browsers any more. Meanwhile, current JAVA environment of a higher version doesn't support it either.

# Solution

## Method that Works Perfectly

There's a relatively simple way to run applet. I have tested it on macOS, and I guess it's similar on Linux or even Windows.

1) Install IntelliJ IDEA.

2) Open IDEA and click "New Project".

4) Run with commands!

Now the IDEA can be closed. (You don't need to really create a project.) Enter the directory where *.applet exists, and run it with appletviewer *.applet command.

❯ l
total 120
drwxr-x---@ 11 colin  staff   352B Jan  6 09:18 .
drwxr-x---@ 11 colin  staff   352B Jan  6 15:45 ..
-rw-r-----@  1 colin  staff    39K Dec  2  2019 avl_seanet.jar
drwxr-x---@ 19 colin  staff   608B Feb 16  2019 images
-rw-r-----@  1 colin  staff   144B Dec  2  2019 index.applet
drwxr-x---@  5 colin  staff   160B Feb 16  2019 sounds
drwxr-x---@ 19 colin  staff   608B Jan  6 08:48 src
❯ appletviewer index.applet

## Other Attempts

Before I found the method above, I tried with a Chrome extension "CheerpJ Applet Runner". Note that it doesn't support running a local file so you can't just drag the applet into Chrome. If you do so, it says "file://" is not supported, and it needs a web server. Luckily, it can be done easily via running a http server with a single python line python3 -m http.server 9090. After that, you can change the file index.applet to applet.html, and open the html in the browser.

The extension can run applets. However, it doesn't perform very well. When I opened the online demo provided by the teacher, or ran the applet hosted by my local http server, the main window of applets could be shown, but the functions didn't work. So the extension only has limited support for running applets.

Last modification：January 7th, 2021 at 08:54 am