Troubleshooting Ptplot

Other sources of information:

  • Ptplot Frequently Asked Questions (FAQ)
  • Below is a list of common Ptplot problems.

    AccessControlException caused by spaces in path name

    Under Java 1.4.0_01, applets that have spaces in the path name may fail if the applet tries to download a data file. For example, the Marks demo tries to access a data file For example, file:///C:/tmp/ptplot/ptolemy/plot/demo/Marks.htm works fine But doing
    cd c:/tmp
    mv ptplot pt\ plot
    and then going to file:///C:/tmp/pt plot/ptolemy/plot/demo/Marks.htm results in access denied ( C:\tmp\ptplot 52\ptolemy\plot\demo\plotmlSample.txt read)
    	at java.lang.SecurityManager.checkPermission(
    	at java.lang.SecurityManager.checkRead(
    	at ptolemy.plot.PlotApplet.init(
    This is a known bug, see: which says:

    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/ 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.

    Problems starting ptplot or running applets

    Security violation

    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:
    The CLASSPATH variable is by far and above the trickiest thing to get right.

    Script fails with: Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/plot/plotml/EditablePlotMLApplication

    Here is an example
    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/EditablePlotMLApplication
    The 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/ptplot
    The 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\' ptolemy.plot.plotml.EditablePlotMLApplication
    Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/plot/plotml/E
    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\' ptolemy.plot.plotml.EditablePlotMLApplication
    In 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: 2002-07-10 08:53:56 -0700 (Wed, 10 Jul 2002) $