Java, JPython, and Netscape

Contents

Java

Version 1.3 of the Java Development Kit (JDK) is installed on the computers running linux. To use Java you need the directory

/APPS/jdk1.3/bin
in your path.

You can tell if this directory is in your path by saying

which java
You should get the reply
/APPS/jdk1.3/bin/java
If not, add this directory to your path with the command (in bash)
PATH=/APPS/jdk1.3/bin:$PATH

Java Documentation

Documentation that comes with this implementation is found at the URL

file:/APPS/jdk1.3/docs/index.html
Bookmark it.

All of this documentation and lots more can be found at http://java.sun.com.

Java Books

Recommended (by me) reading for Java programmers are the following

The Java Plug-in

To make and use Java applets using new features of Java, you need to use the java plug-in for netscape.

These installation instructions are copied from http://java.sun.com/j2se/1.3/install-linux-sdk.html.

  1. Uninstall previous installation of the Java Plug-in, if applicable.
    rm -fr $HOME/.netscape/java
    rm $HOME/.netscape/plugins/javaplugin.so
    
    (You shouldn't need to do this. SuSE 6.4, at least didn't come with the plug-in installed).
  2. Set the NPX_PLUGIN_PATH environment variable before you run netscape.
    export NPX_PLUGIN_PATH=/APPS/jdk1.3/jre/plugin/i386
    netscape
    
    (in order for this environment variable to effect netscape, you must run netscape from the command line, not by clicking on some icon somewhere on your desktop).
  3. You may need to close and restart netscape a couple of times before the plug-in will work because of bug 4358142.
  4. You can test whether the plug-in is working by visiting the page
    http://java.sun.com/docs/books/tutorial/uiswing/start/swingApplet.html
    and clicking on the HelloSwingApplet.html link.

    You should see a box that looks like

    picture of HelloSwingApplet

JPython

JPython 1.1 is installed on the computers running linux. To use JPython you need the directory

/APPS/JPython11
in your path.

You can tell if this directory is in your path by saying

which jpython
You should get the reply
/APPS/JPython11/jpython
If not, add this directory to your path with the command (in bash)
PATH=/APPS/JPython11:$PATH

JPython Documentation

The top-level page of the documentation that comes with this installation is

file:/APPS/JPython11/docs/index.html
Bookmark it.

Using JPython

Python is an object-oriented scripting language. JPython is a complete Python implementation in 100% pure Java in which it is easy to use Java objects. In case it isn't obvious what the example on that page does. It creates a JPython object that is really just a Java object, an instance of the class java.util.Random. Then it calls some of the object's methods. In case that still isn't obvious, this object is written in Java and no different from any object written in Java, for example, one you might write yourself. It just works!


Author: Charles Geyer (charlie@stat.umn.edu). Comments or corrections gratefully accepted.