Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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  
  ClassNotFound error when running applet in browser?  (Read 560 times)
0 Members and 1 Guest are viewing this topic.
Offline RoboAwesome

Junior Newbie





« Posted 2012-12-23 22:02:14 »

Hi,
So I am trying to run a little game I made within a browser. I followed the Spin's tutorial in the wiki but I feel that it left out some important information. I have signed the jar I created from my game and I have all necessary files in the appropriate folder. The HTML is directly copied from the tutorial with the appropriate name changes. Yet I still receive this error
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  
46  
47  
48  
Sun Dec 23 15:41:43 EST 2012 INFO:Clear up
Sun Dec 23 15:41:43 EST 2012 ERROR:org.myorg.SpaceWalk
java.lang.ClassNotFoundException: org.myorg.SpaceWalk
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.newdawn.slick.AppletGameContainer.init(AppletGameContainer.java:124)
   at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1330)
   at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$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)
This occurred while 'Initializing real applet'
Unable to create game container
java.lang.RuntimeException: Unable to create game container
   at org.newdawn.slick.AppletGameContainer.init(AppletGameContainer.java:148)
   at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1330)
   at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$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)


My HTML is here:http://pastebin.com/4fwaUsB1
And a snapshot of my GAME-LIB folder for sanity:

Offline tyeeeee1

Senior Member


Medals: 3
Projects: 1



« Reply #1 - Posted 2012-12-23 22:06:53 »

This probably won't be much help, but try using this HTML just to see if your applet actually works. (I barley know anything about HTML or applets but this is how I was told to test them. This only works if you have one class as far as I know.)

1  
2  
3  
4  
5  
6  
<html>
 <body>
 <applet code = "ClassNameHere.class" width=300 height=300>
 </applet>
 </body>
 </html>
Offline RoboAwesome

Junior Newbie





« Reply #2 - Posted 2012-12-23 22:19:15 »

Hmmm nope. Another ClassNotFound exception, I tried using both main.class and org.myorg.SpaceWalk.main.class in case it didn't know which package to look in. I should note though, that this actually displays "Error: Class Not Found" on the screen whereas my HTML simply shows a blank. Thanks for the reply though

EDIT: To be clear though, it runs correctly when I run it from eclipse
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline ctomni231

JGO Knight


Medals: 28
Projects: 1


Not a glitch. Just have a lil' pixelexia...


« Reply #3 - Posted 2012-12-24 03:15:30 »

Yeah, you are using LWJGL. Which means you are going to need the tutorials to get that specific applet running. You might have to do a bit of looking around, but the link below will give you a good start on how.

Ninja Cave
Offline RoboAwesome

Junior Newbie





« Reply #4 - Posted 2012-12-25 07:25:58 »

Well Slick uses LWJGL's loader so I thought it would be the same? I followed a Slick tutorial this time and I had actually followed that same tutorial you linked previously and ended up with the same error. Frankly, I am starting to wonder if all this time trying to get this browser game running is worth it, with HTML 5 being the new cool kid now. Hell even Javascript looks trendier. Don't get me wrong, Java is still my language of choice and I think Slick+ Java is awesome for GameDev, but I think I might just hop on the HTML5 bandwagon for my next browser game.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 50
Projects: 15


★★★★★


« Reply #5 - Posted 2012-12-25 14:27:03 »

Do try putting all the jars in the same folder as the html file and changing the following part of the html

from
1  
codebase="./GAME-LIB/"

to
1  
codebase="."


Your error basically says it can't find your game class files (maybe because it can't find the jars).
Offline RoboAwesome

Junior Newbie





« Reply #6 - Posted 2012-12-26 00:07:08 »

No luck Sad I tried moving everything to GAME-LIB and I tried putting all the JARS in the root of the folder with the HTML and nadda.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 50
Projects: 15


★★★★★


« Reply #7 - Posted 2012-12-26 01:53:38 »

have you got a link to the actual applet ? should make finding the problem much easier.
Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (102 views)
2013-05-17 21:29:12

alaslipknot (112 views)
2013-05-16 21:24:48

gouessej (140 views)
2013-05-16 00:53:38

gouessej (136 views)
2013-05-16 00:17:58

theagentd (147 views)
2013-05-15 15:01:13

theagentd (133 views)
2013-05-15 15:00:54

StreetDoggy (176 views)
2013-05-14 15:56:26

kutucuk (198 views)
2013-05-12 17:10:36

kutucuk (200 views)
2013-05-12 15:36:09

UnluckyDevil (206 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.257 seconds with 21 queries.