Bug in CollisionListener I think.

Started by Dylan, January 02, 2008, 04:37:01 AM

Previous topic - Next topic

Dylan

I have been looking around for a good starting API that I could modify up a bit but it is always nice to start with one that works. Anyway I have been trying to make the "Car" example an Applet for the web I have looked all over the forum and apparently there are no "running" online applets posted (unless in German). I tried making it an Applet myself but it appears that there is an error in com.threed.jpct.CollisionListener it is: NoClassDefFoundError I won’t post the consol unless I need to. Is anyone having the same problem?

Oh and NoClassDefFoundError is often caused by a small error in the java such as invalid case or misplaced comma. I would look for the error but I can't remember if this API is open source or not, I have looked around in the download and I couldn't find any .java files (other then the examples). Does anyone know the directory it is stored in?

Thanks,
Dylan

EgonOlsen

#1
This must be caused by your port or by the way in which you are embedding your applet, not by jPCT. CollisionListener is an interface with a reference to CollisionEvent and that's it...there's not much room for missing classes. Do you have a stack trace available? Which VM is that?

Kearnan

#2
Sign all of your jar files.

Here's an example of an Applet using JPCT running in a browser in opengl mode.  It implements (text based) world loading and saving, and a few other bells and whistles.

http://www.icebase10.com/jpct/Earendil.zip

I'll leave it there until the end of January.

You can edit the world from the text file and see the results immediately.  From the view window it really only saves the player's position and direction.  The world is just a 3DS model and some trees I made and the objects are simple boxes.  You could use any 3DS world and simply change the player's start position.  And, of-course, you could add as many objects in any arrangement you'd like.

It does, however, run without problems from the index.html file in the "classes/Server Test Uploads/" directory.  I'd never use that html applet loading format for a web page; this was just for testing purposes.

Bell's and Whistle's:  Player can fly around, gravity can be turned on and off and you can select objects (including the world model, the ability I quickly removed as useless after this version).  This was written four months ago and later I used the object selection ability to add, move and remove existing world objects.

It also includes an additional file that adds the animated spider from JPCT's BlueThunder demo.  You simply replace the code from Earendil.java with the Earendil_W/Spider source and put the model and textures into their proper places.  It's just a test for animated models, the model just stands there and performs whatever animation has been assigned.

I wrote this using Borland's JBuilder 2005, email me if you'd like the project files.

In the 'classes' directory you'll find another directory entitled 'Server Test Uploads', this is what was uploaded to my primary server and tested on a variety of comps and ran perfectly on anything with a current Java.  Click on the index.html, after a few seconds you should see simple the forest scene.

Kearnan

#3
I made a couple changes to the previously mentioned applet example.   I changed the world file format to .txt so anyone can open it easily.  The .wurl extension was for my own uses.  And, I had changed the name of the world file to something more descriptive and hadn't changed it everywhere.  Apologies.

EgonOlsen

#4
Quote from: Kearnan on January 03, 2008, 11:31:15 AM
Perhaps EgonOlsen will add this to the JPCT demo section and remove the extra weight and just include the source.
I'll gladly add it to the download section. I'll leave it like it is. If somebody is using JBuilder, it's handy to have the project stuff included.

Edit: It has been added to the download section.

EgonOlsen

BTW: The old version worked for me by simply opening the index.html in a browser. This one doesn't. Maybe you can fix this?

Kearnan

index.html should work now.  I made the changes last night, got into a hurry and neglected my own rule; I didn't sign all of the jars.  Anyway, I believe it should be fine now and includes the world file system as a .txt file.  Thanks

EgonOlsen

It still gives me this when simply clicking on the index.html in classes:

java.lang.NoClassDefFoundError: com/threed/jpct/IPaintListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Kearnan

#8
Ah, yes, that html is for IDE use,  I'll just remove that one, anyone should be able to know how to set up their IDE for an applet.  Those jars aren't signed, they're also only there for IDE use.  The only index.html file that's designed to be clicked on is the one in the "Server Test Uploads" directory.  That's the directory that contains the signed jars.  If the jars aren't signed it won't work in any browser.

I'm guessing that's Dylan's problem.  Applet's are particular creatures.  I don't know of any JVM warning or error that even hints that jars aren't signed, it just tells you you're missing a particular function (NoClassDefFoundError) and normally it's the first thing that's expected to load with the starting class.  In this case, Earendil, like FPS and Cartest, all implement IPaintListener, so the JVM, only when trying to run in a browser - it works fine in the IDE,  just says it can't find it because the jar isn't signed.

Anyway, I simplified the whole package, and asked anyone who'd like the JBuilder project files to simply email me.  The only html file is the one in the 'classes/...Uploads" directory with the signed jars.

Thanks for the help. 

EgonOlsen


Jonas

Simple things should be simple, complex things should be possible - Alan Kay