Java 错误:无法找到或加载主类 sun.applet.AppletViewer

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/54505959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:04:00  来源:igfitidea点击:

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

javaeclipse

提问by Charles Xavier

I'm using eclipse and I'm creating this java appletbut 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?

我正在使用 eclipse 并且我正在创建它,java applet但是当我尝试运行小程序时,我一直遇到以下错误。我知道它在新版本中已被弃用(我什至厌倦了 1.8)但是有什么我可以用它来使它工作的吗?

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

错误:无法找到或加载主类 sun.applet.AppletViewer 导致:java.lang.ClassNotFoundException:sun.applet.AppletViewer

enter image description here

在此处输入图片说明

回答by Tanmoy Bhowmick

I think you are using jdk-13currently install jdk-8and open Eclipse and go to Window->Preferences->Add->nextand find your jvm folder(/usr/lib/jvm) and from there select jdk-8, after adding jdk-8 remove the jdk-13 from Preferences.

我认为您正在使用jdk-13当前安装jdk-8并打开 Eclipse 并转到 Window->Preferences->Add->next并找到您的 jvm 文件夹(/usr/lib/jvm),然后从那里选择jdk-8,添加 jdk-8 后,从首选项中删除 jdk-13。

after that it will start working, if error Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper

之后它将开始工作,如果错误 Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper

comes (linux) then simply run this command : sudo sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties

来(linux)然后只需运行此命令: sudo sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties

it should work. thankyou..

它应该工作。谢谢你..