Charles Xavier
Charles Xavier

Reputation: 1045

Error: Could not find or load main class sun.applet.AppletViewer

I'm using eclipse and I'm creating this java applet but I keep getting below error when I tried to run an applet. I know it's deprecated in the new version (I even tired 1.8) but is there something I can use to make it work?

Error: Could not find or load main class sun.applet.AppletViewer Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer

enter image description here

Upvotes: 9

Views: 57542

Answers (2)

Martin Karari
Martin Karari

Reputation: 188

For support of Applets in Netbeans, you can edit the path to your JDK in netbeans config file which is found in /netbeans-8.2/etc/netbeans.conf. Change the line netbeans_jdkhome="" to your JDK 8 e.g netbeans_jdkhome="/usr/java/jdk1.8.0_241-amd64/"

Upvotes: 1

Tanmoy Bhowmick
Tanmoy Bhowmick

Reputation: 1481

I think you are using jdk-13. However, Applets support jdk-8 and lower.

The current solution for you would be:

  1. Install jdk-8 and open Eclipse.
  2. Go to Window -> Preferences -> Add -> next and find your jvm folder(e.g. /usr/lib/jvm).
  3. From there select jdk-8.
  4. After adding jdk-8, remove the jdk-13 from Preferences.

After everything here, it should start working. If you encounter the error

Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper

you can simply run this command

sudo sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties

Upvotes: 12

Related Questions