Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Error: Could not find or load main class sun.applet.AppletViewer(Create an applet program with Eclipse)
Error: Could not find or load main class sun.applet.AppletViewer [message #1848954] Sun, 26 December 2021 16:10 Go to next message
Eclipse UserFriend
Hello evrybody, i have to create an applet program using Eclipse


I m using linux :

Version: 2021-09 (4.21.0)
Build id: 20210910-1417

So i create a project :

I use an execution environnement jre : JAVASE-1.8

and i leave all option

New i create a class :
i leave evrything empty :

import java.applet.Applet;

public class myApplet extends Applet {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}



and when i lunch my program :

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


do u know how to fix this error please ?

i can lunch my applet in command line and works with this :

to compile i use this line :

javac --release 8 HelloWorldApplet.java

and i lunch it like this :

appletviewer index.html


but on eclipse not working


in commadn line i can lunch the applet with :

java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.21.10)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.21.10, mixed mode, sharing)


if someone can explain me how do the same in eclipse please

thanks


Re: Error: Could not find or load main class sun.applet.AppletViewer [message #1848957 is a reply to message #1848954] Sun, 26 December 2021 23:47 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
If there is no special need to use "java.applet.Applet" then I suggest stop trying using it.
Based on https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/applet/Applet.html
this class is deprecated, for removal: This API element is subject to removal in a future version.
Regards.
Re: Error: Could not find or load main class sun.applet.AppletViewer [message #1848958 is a reply to message #1848957] Mon, 27 December 2021 00:04 Go to previous messageGo to next message
Eclipse UserFriend
Hello again....
Found this:
https://stackoverflow.com/questions/54505959/error-could-not-find-or-load-main-class-sun-applet-appletviewer
Re: Error: Could not find or load main class sun.applet.AppletViewer [message #1848960 is a reply to message #1848958] Mon, 27 December 2021 04:02 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

well i see applet, is abandoned by java !
but in university we need to works with this old techno

so to solve my problem i download Kepler eclipse and now works perfectly

the professor told us to use eclipse and forget to tell us about this problem !!!!


well solved with an old eclipse version, for my project i will used Eclipse Kepler

to download old eclipse is here : https://www.eclipse.org/downloads/packages/release/kepler
Re: Error: Could not find or load main class sun.applet.AppletViewer [message #1848965 is a reply to message #1848960] Mon, 27 December 2021 05:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Kepler is not just old, it is really really old. Possibly not even supporting Java 9.

As a student you really should be using current technology, in particular Java >= 11. Your future employer will not be impressed if you extol the virtues of Kepler.

As a favor to your colleagues and successors, I suggest That you prod your professor to move out of the dark ages.

Regards

Ed Willink
Re: Error: Could not find or load main class sun.applet.AppletViewer [message #1849509 is a reply to message #1848958] Sat, 22 January 2022 02:28 Go to previous message
Eclipse UserFriend
Got this. Thank you
Previous Topic:Behaviour of @MetaInfServices annotation
Next Topic:Tools for Oracle WebLogic server
Goto Forum:
  


Current Time: Sun Aug 10 02:05:30 EDT 2025

Powered by FUDForum. Page generated in 0.04130 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top