Other sources of information:
The summary is that PtPlot was written a very long time ago and includes Java applet demonstrations. Today, PtPlot is used extensively in the Ptolemy II standalone Java application. However, in general, support for Java applets has fallen by the wayside over the years. In particular, unsigned applets do not run in the default and unsigned applets may soon not be supported at all. The problems below are specific to applets. PtPlot works well in Java stand-alone applications.
Below is a list of common Ptplot problems.Under Firefox on the Mac, visiting an applet may bring up a dialog that says:
Applicatiion Blocked by Security Settings
Your security settings have blocked an untrusted application from running
The solution is to go to the System Preferences -> Other -> Java and then under the Security tab in the Java Control Panel set the Security Level to Medium.
It is probably necessary to restart the browser.
If you are browsing the release and the files are installed on the local machine, then there is a good chance that the applets won't run inside a browser.
One workaround is to run appletviewer
on the .htm file
that contains the applet.
Another workaround is to view the demos on the Ptolemy II website at
https://ptolemy.berkeley.edu/java/ptplot/
.
file:///C:/tmp/ptplot/ptolemy/plot/demo/Marks.htm
works fine
But doing
cd c:/tmp mv ptplot pt\ plotand then going to
file:///C:/tmp/pt plot/ptolemy/plot/demo/Marks.htm
results in
java.security.AccessControlException: access denied (java.io.FilePermission C:\tmp\ptplot 52\ptolemy\plot\demo\plotmlSample.txt read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:542) at java.lang.SecurityManager.checkRead(SecurityManager.java:887) at java.io.File.isDirectory(File.java:698) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:65) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:148) at java.net.URL.openStream(URL.java:955) at ptolemy.plot.PlotApplet.init(PlotApplet.java:133) at sun.applet.AppletPanel.run(AppletPanel.java:341) at java.lang.Thread.run(Thread.java:536)This is a known bug, see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4697178 which says:
CUSTOMER WORKAROUND :
A couple of workarounds found:o Don't package the files into a JAR. Problem does not appear to occur when just .class files are available.
o Change directory of installed applet to one without spaces in the name.
o Access the HTML file using an HTTP URL. Problem only occurs when file is accessed via a file URL.
o Use policytool to modify the java security file, giving permission to the file being read (was suggested by another user here with the problem; did not confirm myself).
xxxxx@xxxxx 2002-06-11
This is due to the special charactor for space. When we add the permission for the file to read, we still use "%20" instead of the real " " for the path, which cause the applet don't have the permission to read the file.
Solution: In src/share/classes/sun/applet/AppletClassLoader.java call ParseUtil.decode(path) method before add the permission.
Unfortunately, this bug means that if we ship a prebuilt version of ptplot or Ptolemy II and the user tries to access the applets from the local partition, then there will be errors.
The only applets that fail are applets that are on a local file system, accessed with file://, that have spaces in the path and the applet needs to access a data file that is local.
This bug is not present in Java 1.3.1_03 and 1.4.1-beta.
One known problem is that if you have a CLASSPATH environment set when you started your browser, you may get an error message when accessing some of the demos. We suggest unsetting this environment variable, restarting your browser (and sending email to Sun's Java team to complain about the way the CLASSPATH environment variable works). You may also want to check the Java FAQ.
If you have CLASSPATH set, and you run Netscape, then you might see messages like:
Applet Marks can't start: security violation: security.class from local disk trying to access url: https://ptolemy.berkeley.edu/java/ptolemy/plot/demo/data.pltThe CLASSPATH variable is by far and above the trickiest thing to get right.
bash-2.02$ ./ptplot ./ptplot: Could not find '/tmp/ptolemy/plot'. Perhaps your PTII variable is not set properly? Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/plot/plotml/EditablePlotMLApplicationThe problem here is that the pxgraph script cannot find the ptplot installation. This probably means that your PTII environment variable is not set correctly. Set it to point to the home directory of the plot or Ptolemy II distribution.
To debug such a situation completely,
use which
(on Unix) or type
(on Windows with Cygwin)
to find out which ptplot
script is running, and the run it with the sh -x
flag:
First we run which
:
bash-2.02$ type ptplot ptplot is /users/cxh/ptII/bin/ptplotThe we use
sh -x
. Note that the output you see might be
different, depending on what version of the pxgraph
script
you are running.
bash-2.02$ sh -x /users/cxh/ptII/bin/ptplot + PTII_DEFAULT=/users/cxh/ptII_old + PTJAVA_DIR=/jdk1.2.2 + '[' -z '' ']' + '[' -d /users/cxh/ptII_old ']' + PTII=/users/cxh/ptII_old + export PTII + '[' '!' -d /users/cxh/ptII_old/ptolemy/plot ']' + echo '/users/cxh/ptII/bin/ptplot: Could not find '\''/users/cxh/ptII_old/ptole my/plot'\''. Perhaps your PTII' /users/cxh/ptII/bin/ptplot: Could not find '/users/cxh/ptII_old/ptolemy/plot'. Perhaps your PTII + echo ' variable is not set properly?' variable is not set properly? ++ basename /users/cxh/ptII/bin/ptplot + '[' ptplot = pxgraph ']' ++ basename /users/cxh/ptII/bin/ptplot + '[' ptplot = histogram ']' + javastartupclass=ptolemy.plot.plotml.EditablePlotMLApplication + windows=no + windows=yes + '[' -z '' ']' + '[' -d /jdk1.2.2 ']' + JAVAHOME=/jdk1.2.2 + export JAVAHOME + '[' -z /jdk1.2.2 ']' + '[' -z /jdk1.2.2 ']' + '[' yes = yes ']' ++ cd /users/cxh/ptII_old ++ cmd /c chdir ++ tr -d '\r' + WINPTII=D:\users\cxh\ptII_old + /jdk1.2.2/bin/java -classpath 'D:\users\cxh\ptII_old;/jdk1.2.2\lib\classes.zip' ptolemy.plot.plotml.EditablePlotMLApplication Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/plot/plotml/E ditablePlotMLApplication bash-2.02$In the output below, the key line is the line towards that bottom that runs the
java
interpreter:
+ /jdk1.2.2/bin/java -classpath 'D:\users\cxh\ptII_old;/jdk1.2.2\lib\classes.zip' ptolemy.plot.plotml.EditablePlotMLApplicationIn the ptplot script, the first element in the
-classpath
argument should be a pathname that leads to the top of the Ptolemy II
or Ptplot directory tree.
In this case, there are two problems, one is that $PTII
is not set, so the script is using the value of PTII_DEFAULT
which was hardwired into the script when configure
was run.
Unfortunately, the ptplot
script
was left over from an old installation, and at the top
of the script PTII_DEFAULT was set to /users/cxh/ptII_old
is an empty directory that does not contain a Ptolemy II tree.
The fix is to rerun configure
and
make install
so that the ptplot
script
is properly set up.
Another common fix is to edit the pxgraph
script
and change the variables at the top to point to the proper location.
Last Updated: $Date: 2014-09-24 07:50:41 -0700 (Wed, 24 Sep 2014) $