Troubleshooting Ptplot

Other sources of information:

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

    Problems Starting Ptplot

    CLASSPATH

    CLASSPATH is by far and above the trickiest thing to get right.

    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:
    http://ptolemy.eecs.berkeley.edu/java/ptolemy/plot/demo/data.plt
    

    pxgraph script fails with: Unable to initialize threads: cannot find class

    Below is an example:
    ptplot> ./pxgraph
    Unable to initialize threads: cannot find class
    java/lang/Thread
    
    The problem here is that the java interpreter is not finding lib/classes.zip in the Java Development Kit distribution.

    One fix is to edit the pxgraph script and change JAVADEFAULT variable to point to the location of your JDK. HOME

    Another fix is to set the JAVAHOME variable to point to your JDK and rerun pxgraph:

    cxh@carson 41% setenv JAVAHOME /opt/jdk1.1.6
    cxh@carson 42% pxgraph -help
    Usage: pxgraph [ options ] [=WxH+X+Y] [file ...]
     options that take values as second args:
    
    For further debugging, you might find it helpful to follow the instructions below.

    pxgraph script fails with: Can't find class ptolemy.plot.Pxgraph

    Here is an example
    carson [3] pxgraph -help
    Can't find class ptolemy.plot.Pxgraph
    carson [4]
    
    The problem here is that the pxgraph script cannot find the ptplot installation.

    The solution here is to use which to find out which pxgraph script is running, and the run it with the sh -x flag:

    First we run which:

    carson [9] which pxgraph
    /users/ptdesign/bin.sol2.5/pxgraph
    
    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.
    carson [10] sh -x /users/ptdesign/bin.sol2.5/pxgraph -help
    PTDEFAULT=/users/ptdesign
    TYDEFAULT=/users/ptdesign/tycho
    JAVADEFAULT=/opt/jdk1.1.6
    + [ -z /users/cxh/ptbuild ]
    + [ -z  ]
    + [ /users/cxh/ptbuild -a -f /users/cxh/ptbuild/tycho/bin/ptarch ]
    TYCHO=/users/cxh/ptbuild/tycho
    + export TYCHO
    windows=no
    + uname
    + [ SunOS = CYGWIN32/NT ]
    + [ -z  ]
    + [ -d /opt/jdk1.1.6 ]
    JAVAHOME=/opt/jdk1.1.6
    + export JAVAHOME
    + [ -z /opt/jdk1.1.6 ]
    + [ ! -r /opt/jdk1.1.6/lib/classes.zip ]
    + [ no = yes ]
    + /opt/jdk1.1.6/bin/java -classpath /users/cxh/ptbuild/tycho/java:/opt/jdk1.1.6/lib/classes.zip ptolemy.plot.Pxgraph -help
    Can't find class ptolemy.plot.Pxgraph
    carson [11]
    
    In the output below, the key line is the line towards that bottom that runs the java interpreter:
    + /opt/jdk1.1.6/bin/java -classpath /users/cxh/ptbuild/tycho/java:/opt/jdk1.1.6/lib/classes.zip ptolemy.plot.Pxgraph -help
    
    In the pxgraph script, the first element in the -classpath argument should point lead to the ptplot.zip file. In this case, /users/cxh/ptbuild/tycho/java/ptolemy/plot/ptplot.zip should exist, but it does not:
    carson [12] ls -l /users/cxh/ptbuild/tycho/java/ptolemy/plot/ptplot.zip
    /users/cxh/ptbuild/tycho/java/ptolemy/plot/ptplot.zip not found
    
    In this case the problem was that the user did not have Ptplot installed in the location that the pxgraph script was guessing. The fix was to install it.

    Another common fix is to edit the pxgraph script and change the variables at the top to point to the proper location. See the Pxgraph Installation Instructions for details.


    I can't access the Plot class from a java interpreter

    If you try to run the Pxgraph class by passing the Pxgraph classname as a command line argument to the java interpreter, you might see:
    ptplot> java Pxgraph
    java.lang.NoClassDefFoundError: ptolemy/plot/Plot
            at ptolemy.plot.Pxgraph.<init>(Pxgraph.java)
            at ptolemy.plot.Pxgraph.main(Pxgraph.java)
    
    The problem here is that the Ptplot java classes are in the Ptplot java package, so you need to set your CLASSPATH to the directory that contains the ptplot directory, not the directory that contains the Pxgraph.class file So if Pxgraph.class was in the /usr/local/java/ptplot directory, you would set your classpath to /usr/local/java

    The following two examples show two ways to set your classpath.

    cxh@carson 32% setenv CLASSPATH ..:/opt/jdk1.1.6/lib/classes.zip
    cxh@carson 33% java ptolemy.plot.Pxgraph -help
    Usage: pxgraph [ options ] [=WxH+X+Y] [file ...]
     options that take values as second args:
     -bd <color> (Unsupported)
    
    cxh@carson 34% unsetenv CLASSPATH
    cxh@carson 35% java -classpath ..:/opt/jdk1.1.6/lib/classes.zip ptplot.Pxgraph -help
    Usage: pxgraph [ options ] [=WxH+X+Y] [file ...]
     options that take values as second args:
     -bd <color> (Unsupported)
    
    Note that you can also set the classpath to include the ptplot.zip file, rather than including the directory that the ptplot directory resides in:
    cxh@carson 36% unsetenv CLASSPATH
    cxh@carson 57% java -classpath ptplot.zip:/opt/jdk1.1.6/lib/classes.zip ptplot.Pxgraph -help
    Usage: pxgraph [ options ] [=WxH+X+Y] [file ...]
     options that take values as second args:
     -bd <color> (Unsupported)
    
    

    Ptplot Infrastructure


    Copyright © 1997-1998 The Regents of the University of California. All rights reserved.
    Last updated: $Date: 1998/11/17 22:26:59 $, comments to: cxh@eecs.berkeley.edu