www.jpct.net

jPCT - a 3d engine for Java => Bugs => Topic started by: dear_stephen on May 08, 2007, 11:19:40 am

Title: JRE 1.1
Post by: dear_stephen on May 08, 2007, 11:19:40 am
I have just tested my applet on the microsoft jre 1.1 and I get the following error message...
Code: [Select]
java.lang.NoSuchMethodError: java/awt/Color: method getAlpha()I not found
at com/threed/jpct/FrameBuffer.clear
at com/algodes/jpct/JPCTApplet.init
at com/algodes/jpct/Earth.init
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run


It seems that an incompatible function has slipped in.

Is this a bug? Is there a work around?

thanks,
Stephen

Title: Re: JRE 1.1
Post by: EgonOlsen on May 08, 2007, 11:36:45 am
This happens from time to time, because i don't test against 1.1 anymore and if the docs don't state that a method is 1.2+, we have a problem. I'll try to fix it.
Title: Re: JRE 1.1
Post by: hytparadisee on May 08, 2007, 11:44:41 am
hmmm. A post just slipped in before mine. Egon!! Ya, This is possibly because getAlpha() is a method from Java API (java.awt.Color), not from jpct. It's just that jpct makes use of this method. I do not have the source but I think Egon tries to clear the buffer with a specified color. Perhaps Microsoft VM does not support transparent color?  ::)
Title: Re: JRE 1.1
Post by: EgonOlsen on May 08, 2007, 02:40:23 pm
Alpha for Color wasn't available in 1.1. The JavaDocs don't seem to mention this...at least i couldn't spot it, that's why this one slipped through...
Title: Re: JRE 1.1
Post by: EgonOlsen on May 08, 2007, 06:00:33 pm
Ok, please try the jar at http://www.jpct.net/download/beta/jpct.jar (http://www.jpct.net/download/beta/jpct.jar) and let me know if the problem is fixed now.
Title: Re: JRE 1.1
Post by: dear_stephen on May 09, 2007, 04:41:54 pm
It didn't work  :( I got the same error. try something like...

Code: [Select]
            Color RED = new Color(255, 0, 0, 100);
            Class c = RED.getClass();
            try {
              Method method = c.getMethod("getAlpha", new Class[] {});
              System.out.println("alpha: "+method.invoke(RED, null));
            } catch (Exception e) {
              System.out.println("Could not getAlpha");
            }


otherwise you could send me the source and I'll do it  ;)  ;)  ;)

Title: Re: JRE 1.1
Post by: EgonOlsen on May 09, 2007, 05:35:23 pm
It didn't work  :( I got the same error. try something like...

Code: [Select]
            Color RED = new Color(255, 0, 0, 100);
            Class c = RED.getClass();
            try {
              Method method = c.getMethod("getAlpha", new Class[] {});
              System.out.println("alpha: "+method.invoke(RED, null));
            } catch (Exception e) {
              System.out.println("Could not getAlpha");
            }
I know that...i just don't want to do this every frame. Using reflection is not very expensive on modern VMs, but it can be on older ones and that is where it counts in this case. I'll write a wrapper for Color then that does the trick.
Title: Re: JRE 1.1
Post by: EgonOlsen on May 09, 2007, 06:10:00 pm
Ok, i've updated the jar. Please give it a try now.
Title: Re: JRE 1.1
Post by: EgonOlsen on May 11, 2007, 12:28:08 am
Is it fixed now?
Title: Re: JRE 1.1
Post by: dear_stephen on May 11, 2007, 02:20:52 pm
It got past that error but has reached the next one  :(

java.lang.NoSuchMethodError: java/util/Vector: method add(Ljava/lang/Object;)Z not found
   at com/threed/jpct/VisListManager.getVisList
   at com/threed/jpct/World.renderScene
   at com/algodes/jpct/JPCTApplet.mainLoop
   at com/algodes/jpct/JPCTApplet.run
   at java/lang/Thread.run

cheers,
Stephen
Title: Re: JRE 1.1
Post by: EgonOlsen on May 11, 2007, 02:47:43 pm
ARGHHH!!! But at least that one is easy to fix. I'll post a fixed version later today.
Title: Re: JRE 1.1
Post by: EgonOlsen on May 11, 2007, 04:59:43 pm
Ok, the jar has been updated (once again). I can't wait to see where i've broken 1.1 compatibility next...
Title: Re: JRE 1.1
Post by: dear_stephen on May 14, 2007, 11:08:19 am
Yippie!

It all seems to be working supa dupa!

Thanks very much!


tooteloo,
Stephen