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: Set up key shortcuts and adjust formatter defaults

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

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

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 6: 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 7: 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.