Setting Up JPT in Eclipse

Step 1: Download the library jpt.jar

Download the JPT library jpt.jar and store this library in a convenient directory on your local file system.

Step 2: Set up a classpath variable reference JPT to jpt.jar in Eclipse

Define the classpath variable reference JPT in Eclipse 3.2

Step 3: Adjust the Eclipse compiler error/warning settings

To promote easier Java experimentation in Eclipse, we recommend changes to the default compiler error/warning settings.

Recommendations for compiler error/warning settings in Eclipse 3.2

Step 4: Create a sample project that is ready to use JPT

Set up a simple key shortcut so it is easy to run a Java application in Eclipse 3.2

Modify the default formatter so tabs will be replaced by spaces in Eclipse 3.2

Set up a sample project that can use the JPT library jpt.jar in Eclipse 3.2

Here is a link to the testing class Methods.java used in the above screen snapshots.

Step 5: Decide Java imports in a Java file

Some people prefer to add Java imports incrementally as particular library classes are used in the code. However, we have found that experimentation is enhanced if we do not have to stop and think about what Java libraries to import. Therefore, after years of experience, we recommend the following list of imports as a useful default. Later, when the design and coding of the class is complete, the list may be pared down to a minimal list. The import list below includes the JPT imports and the most frequently used Java imports.

import edu.neu.ccs.*;
import edu.neu.ccs.gui.*;
import edu.neu.ccs.codec.*;
import edu.neu.ccs.console.*;
import edu.neu.ccs.filter.*;
import edu.neu.ccs.jpf.*;
import edu.neu.ccs.parser.*;
import edu.neu.ccs.pedagogy.*;
import edu.neu.ccs.quick.*;
import edu.neu.ccs.util.*;

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.font.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
import java.util.*;
import java.math.*;
import java.beans.*;
import java.lang.reflect.*;
import java.net.URL;
import java.util.regex.*;
import java.text.ParseException;

You may select the above list, copy it, and then paste it into the top of a Java file.

Eclipse offers the option of minimizing the import list so only the first line of the list is visible in the editor pane. In the screen snapshots, we have in fact minimized the import lists to save screen real estate.

Step 6: Create Java Files

Using the Java imports in Step 5, you are ready to create Java source files that freely use both JPT and pure Java.

Comments

If you want an elegant environment for both experimentation and systematic testing, consider the Java Power Framework. For more information, click the link for Java Power Frame in the left hand panel.

For demonstration programs that use the latest features in JPT, click the link for Demonstrations in the left hand panel.

For older demonstration programs and access to the tutorial known as the JPT Book, click the link for JPT 2.3.5 in the left panel.

If you use the JPT 2.3.5 material, keep in mind the following changes to JPT since that release.

JPT 2.4.0 is almost 100% compatible with JPT 2.3.5 but not quite. One of the key forces leading to this release was the realization that the Paintable interface needed to have the mutatable properties that were formerly in MutatablePaintable. This led to the merger of the interfaces and to the deletion of certain support classes that were no longer necessary. The one class with some utility, namely, MutatableWrapper was renamed more simply to Tile.

JPT 2.5.0 is almost 100% compatible with JPT 2.4.0 but not quite. One of the key forces leading to this release was the desire to permit a user to define simple functions in the JPT interactive parser as well as well as to enable variable definitions that may be either persistant or temporary. This required refactoring of the parser classes and renaming of the old AbstractParser class to be BasePaser, a class that is no longer abstract. All algorithmic code migrated down to BasePaser from class JPTParser. The purpose of JPTParser is now to define built-in functions, operations, and constants. A new exponentiation operator denoted by a caret has been added to class JPTParser.