Hello to all.
I have build a Java GUI application and now i want to convert and transfer it to an applet.
I assume that whatever i have in
public void main
will now go to the init() method of the JApplet.
Now the problem is to embed it to the webpage...
I have this code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="_css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<applet code="Applet1.class" width="400" height="300">
</<applet>
</body>
</html>
the index.html and Applet1.class are in the same directory but when i am trying to run the applet is loading and then its says
Error. Click here for details
I got this error report
java.lang.NoClassDefFoundError: Applet1 (wrong name: sourceCode/Applet1)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NoClassDefFoundError: Applet1 (wrong name: sourceCode/Applet1)
I suppose the problem is here?
Applet1 (wrong name: sourceCode/Applet1)
where sourceCode is the package that i have declared in Eclipse???
When i run the Applet in Eclipse everything is ok, when i try to run it in browers i have the problem.
What i have to do?
Thanks in advance!