Author Topic: Bug in CollisionListener I think.  (Read 11823 times)

Offline Dylan

  • byte
  • *
  • Posts: 1
    • View Profile
Bug in CollisionListener I think.
« on: January 02, 2008, 04:37:01 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bug in CollisionListener I think.
« Reply #1 on: January 02, 2008, 04:06:35 pm »
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?
« Last Edit: January 02, 2008, 04:17:25 pm by EgonOlsen »

Kearnan

  • Guest
Re: Bug in CollisionListener I think.
« Reply #2 on: January 03, 2008, 11:31:15 am »
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.
« Last Edit: January 07, 2008, 12:05:19 am by Kearnan »

Kearnan

  • Guest
Re: Bug in CollisionListener I think.
« Reply #3 on: January 06, 2008, 01:27:29 am »
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.
« Last Edit: January 06, 2008, 01:42:22 am by Kearnan »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bug in CollisionListener I think.
« Reply #4 on: January 06, 2008, 11:48:20 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.
« Last Edit: January 06, 2008, 11:59:51 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bug in CollisionListener I think.
« Reply #5 on: January 06, 2008, 12:43:41 pm »
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

  • Guest
Re: Bug in CollisionListener I think.
« Reply #6 on: January 06, 2008, 04:57:31 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bug in CollisionListener I think.
« Reply #7 on: January 06, 2008, 05:23:20 pm »
It still gives me this when simply clicking on the index.html in classes:
Code: [Select]
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

  • Guest
Re: Bug in CollisionListener I think.
« Reply #8 on: January 06, 2008, 06:01:32 pm »
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. 
« Last Edit: January 06, 2008, 06:37:40 pm by Kearnan »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Bug in CollisionListener I think.
« Reply #9 on: January 06, 2008, 08:08:00 pm »
Works great now!  ;D

Offline Jonas

  • byte
  • *
  • Posts: 41
    • View Profile
Re: Bug in CollisionListener I think.
« Reply #10 on: January 07, 2008, 03:12:04 pm »
Nice work :)
Simple things should be simple, complex things should be possible - Alan Kay