0

We are developing a prototype on an old TV box that runs Java applets (via PersonJava JRE 1.1.8). The box runs applets great, no problems.

However, we would like to use appletviewer (from Java 8) to develop locally. However, appletviewer is not able to load images from the documentBase. Images load fine in applet on the TV Box, the problem is in appletviewer.

We understand that applets are deprecated, but we would still like to have a nice development process for this project. Alternatively, are there any other easy ways to run applets in 2021?

In the appletviewer this code:

bgImage = getImage(getDocumentBase(), "myImage.gif");

leads to this error:

java.security.AccessControlException: access denied ("java.net.URLPermission" "http://localhost:8080/applets/hello/myImage.gif" "*:*")

adamM
  • 1,116
  • 10
  • 29

2 Answers2

0

It seems like the appletviewer program is broken. Despite various attempts to set security policies, the appletviewer does not allow downloading images from the remote documentBase (as an applet allows). This makes developing applets a bit challenging, because there is no simple way to run an applet in 2021.

Our solution is to build out the entire code base as an awt.Container, which can be loaded locally into an awt.frame for developement, and then also deployed into an applet for the prototype running on the TV Box. An awt.frame can do most everything an applet can do, so it works well.

adamM
  • 1,116
  • 10
  • 29
0

Create a file grant-all.policy with the following contents:

grant {
    permission java.security.AllPermission "", "";
};

and run the applet with

appletviewer -J-Djava.security.policy=grant-all.policy https://the.url.to/your.applet.html