Efrat Jaeger <[EMAIL PROTECTED]> writes:
-----
    I created the following applet,
    http://users.sdsc.edu/~efrat/workflows/queryPGAP.htm, very similar to
    the demo applets. Apparently it loads on some computers but on others I
    get a "java.lang.NoClassDefFoundError: ptolemy/actor/gui/MoMLApplet"
    error. On the same computers the existing demo applets load perfectly. I
    wasn't able to figure out what causes the exception. Does anyone have
    any suggestions?
-----

Applets are notoriously tricky to get right.
I looked over the source code and did not see anything obvious. 

There is some documentation at
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIlatest/ptII/doc/coding/applets.htm

and there is a custom applet chapter in Volume 2 of the Ptolemy II
design doc:
http://ptolemy.eecs.berkeley.edu/papers/03/ptIIDesignSoftware

The applet code you are using is the complex applet code that
will work under Netscape 4.x.  If you do not require support
of Netscape 4.x, then you could use the much simpler 
<applet>
..
</applet>
code.

In fact, for debugging, I would use the simple applet code so
that you are testing the same html code on the different platforms.

Another trick is to look at the website logs and see what files
are being downloaded.

With Java 1.4.2, I noticed that if a class was loaded from a jar
file, then it seemed like the applet class loader would not
find individual .class files on the file system.  The solution
was to make sure and have the archive= tag include jar
files that included all the .class files.  I'm not
sure about the details of this new behaviour, I poked
around on the Sun website but did not see anything.

When I tried to run your applet, I had to install Java 1.4.1_02,
the applet would not run with Java 1.5.0-beta under Mozilla.

Applets can have dynamic versioning or static versioning.

Dynamic versioning permits a JRE greater or equal to a a certain
version to be used.

Static versioning requires that a certain version of JRE 
be used.

The details are covered in:
  http://java.sun.com/products/plugin/versions.html

>From the title tag, it looks like your applet is based on one of the
Ptolemy Eye applets.

It looks like your applet and the Ptolemy II 3.0 SDF Eye applet are
using dynamic versioning under IE, but static versioning under
Mozilla?  This would be a bug.

The IE section says:
   classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
which
http://java.sun.com/products/plugin/versions.html
indicates is for dynamic versioning.

The Netscape section says:
   application/x-java-applet;jpi-version=1.4.1_02"
http://java.sun.com/products/plugin/versions.html
indicates is for static versioning.

The applet code shipped in Ptolemy II 3.0 in theory uses static
version to restrict the version of the JVM can be used to 1.4.1_02.
This was done because of a bug in 1.4.1 and 1.4.1_01 that machines
that use a particular video chip set to hang.  Since Professor Lee and
I were affected by this bug, we restricted the JVM choice to 1.4.1_02.
I tried to make the applet use dynamic versioning for Netscape so
we would accept 1.4.1_02 or greater, but could not
get this to work, it appeared to be a problem with the patch level.

If possible, it is better to use dynamic versioning.
The Ptolemy II 4.0 applets use dynamic versioning correctly to
require Java 1.4.2 or later.  In principle, Java 1.5.0-beta
should work with these applets.

In general, applets have restrictions:

1) Don't use the readFile() expression function in a model that
is within an applet.  This is because of restrictions in the
applet class loader.

2) If possible, use the simple <applet> ...</applet> code
and avoid the really complex javascript code.  If you really
think you need to support Netscape 4.x, consider looking
at the web server logs for the number of Netscape 4.x users
and evaluate the cost of supporting applets for those
users.  Note that Ptolemy II 4.0 supports Netscape 4.x.
Perhaps the next release of Ptolemy II applets will not
support Netscape 4.x?

3) The MoMLViewerApplet class does not permit look inside.
It would be cool if we could use the Single Window interface created
by Thales within an applet.
To run the single window interface in Ptolemy II 4.0, do
   $PTII/bin/vergil -single
The idea would be to create an applet that would use this interface

4) The code generator will generate applets for a model. 
See $PTII/doc/codegen.htm for somewhat out of date documentation.
There will be a chapter in the design doc about how to use the
applet generator.

5) For vergil applets, it might be better to create Web Start
versions.  I noticed that the Java Event Listener Tutorial
is now using Web Start, see
http://java.sun.com/docs/books/tutorial/uiswing/events/example-1dot4/
I started hacking up the applet code generator to generate both
applets and Web Start configurations, but I never really finished
that work

BTW - If you use the controls parameter in your applet, then users
can run the applet.  
To do this, you would add the following tags

To the IE section:
            <PARAM NAME = "controls" VALUE = "buttons" > 
To the Netscape section:
        controls = "buttons" 
To the generic section
            <PARAM NAME = "controls" VALUE = "buttons" > 


Hope this helps, let me know if you have further questions.

-Christopher
 



----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to