Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java applet error  (Read 1611 times)
0 Members and 1 Guest are viewing this topic.
Offline SubzeroX5

Senior Newbie





« Posted 2011-08-29 23:24:24 »

When I try to run an applet for my game, I get an error that looks like this.
http://i1201.photobucket.com/albums/bb356/SubzeroX5/AppletError.png

I clicked on it, and got a message that looked like this.
http://i1201.photobucket.com/albums/bb356/SubzeroX5/Javaconsole.png

How do I know what's wrong?

Offline aazimon
« Reply #1 - Posted 2011-08-29 23:31:42 »

Well, you're looking in the right place. I assume your code works locally? Can you load the HTML locally and run the applet? Double check the applet tag settings in the HTML page. Does the code attribute (in the tag) have the full package path?
Offline zoto

Senior Member


Medals: 4



« Reply #2 - Posted 2011-08-30 00:56:21 »

It just looks like the class isn't found.
Can't really tell anything else without seeing the code, can you link a page with the applet?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SubzeroX5

Senior Newbie





« Reply #3 - Posted 2011-08-30 03:16:41 »

Thanks for your reply. Heres my source code.
Build http://www.mediafire.com/?bas4apehvz1aoo7
src http://www.mediafire.com/?toc0k3j2mnmi1gb


I've found the reason, but I can't seem to get why. Its because I had a package called ultrapong, that had all my source codes and other packages in it.

Kinda like this
http://s1201.photobucket.com/albums/bb356/SubzeroX5/?action=view&current=packages.png

But if I didn't have them all in the package ultrapong and had them in the netbeans default package,some classes won't be able to extend another class.
Offline zoto

Senior Member


Medals: 4



« Reply #4 - Posted 2011-08-30 03:51:56 »

You would need to include the classes from your other package or us the FQN. This link should clear all that stuff up for you. http://download.oracle.com/javase/tutorial/java/package/packages.html

I was wondering if your html applet tag had something like this in it
1  
code="ultrapong.Applet.GameApplet"


Offline SubzeroX5

Senior Newbie





« Reply #5 - Posted 2011-08-30 18:58:43 »

Originally, my code looked like this
1  
code = "UltraPong.class"

So I tried
1  
code = "ultrapong.UltraPong.class"

But after the link you gave me(Thanks, that was really helpful  Grin)
my code looks like this
1  
code ="ultrapong"

Since all my codes and packages are under ultrapong.

But for some reason, it sill didn't work. Did I miss or misunderstand something?
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #6 - Posted 2011-08-30 19:01:45 »

1  
code = "ultrapong.UltraPong"

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline SubzeroX5

Senior Newbie





« Reply #7 - Posted 2011-08-30 19:04:16 »

Thanks for the quick reply.
But for some reason, even the
1  
code = "ultrapong.UltraPong"


Didn't work.
Offline aazimon
« Reply #8 - Posted 2011-08-30 23:30:14 »

Go into the build directory that you posted in the build zip file, above. There is a file "UltraPong.html". Load that in your favorite bowser. I ran it this way and got this stack trace. After you fix the NoClassDefFoundError, use that html and add a classes directory for your source code, or make a jar file and change the HTML line (codebase="classes") to (archive="Jarname.jar").

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
java.lang.RuntimeException: java.lang.NoClassDefFoundError: mylibrary/Graphics/Button
   at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: mylibrary/Graphics/Button
   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 ultrapong.startscreen.Menu.<init>(Menu.java:27)
   at ultrapong.UltraPong.<init>(UltraPong.java:30)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: mylibrary.Graphics.Button
   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)
   ... 32 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: mylibrary/Graphics/Button
Offline SubzeroX5

Senior Newbie





« Reply #9 - Posted 2011-08-31 20:51:14 »

Thanks for the really helpful answer!

It works now  Grin

If you don't mind, could you tell me how to stack trace an applet.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline aazimon
« Reply #10 - Posted 2011-09-01 15:57:48 »

You were looking in the right place. It will show up in the console.
 I suspect your applet tag was not set correctly. If you use the file structure from the build directory and the HTML in there, you should be able to get it working.
Offline SubzeroX5

Senior Newbie





« Reply #11 - Posted 2011-09-01 22:04:18 »

Thanks  Grin
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (81 views)
2014-04-15 18:08:23

BurntPizza (73 views)
2014-04-15 03:46:01

UprightPath (84 views)
2014-04-14 17:39:50

UprightPath (67 views)
2014-04-14 17:35:47

Porlus (83 views)
2014-04-14 15:48:38

tom_mai78101 (107 views)
2014-04-10 04:04:31

BurntPizza (167 views)
2014-04-08 23:06:04

tom_mai78101 (263 views)
2014-04-05 13:34:39

trollwarrior1 (213 views)
2014-04-04 12:06:45

CJLetsGame (223 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!