Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

eclipse

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

like image 502
Charles Xavier Avatar asked Feb 03 '19 18:02

Charles Xavier


1 Answers

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

like image 132
Tanmoy Bhowmick Avatar answered Sep 18 '22 11:09

Tanmoy Bhowmick