|
CS367 Fall 2004
Introduction to Data Structures
|
|
TextPad Configuration
TextPad is a shareware program that can be used to edit several types of
text only files, such as C/C++/Java source files, HTML and others.
It is available for download from www.textpad.com
It is similar to programs like Notepad in that there are no text or page
formatting options. It is better than Notepad because it understands much of
the basic structure of various programming languages and it can be configured
to understand others.
If any version of the Java Software Development Kit has been installed
on your PC, then the installation of TextPad will be able to compile Java
programs through the "Tools" menu.
If you have not installed any Java stuff yet, I recommend doing so in this order.
- Download and install the latest non-beta release of J2SE from java.sun.com
- Download and install TextPad from www.textpad.com
- Download and install junit.jar from www.junit.org
Several students have asked how I configured my installation to be able
to compile and run JUnit test case classes.
It's easy to do. Be sure to read the help and other information on how to
configure the "Tools" menu in TextPad.
Here's a brief outline of the steps .
To add a "Compile JUnit" option to your "Tools" menu in TextPad
Create a new Tools menu option that includes the junit.jar file in its classpath.
Note: I recommend that you keep the existing tools as they are, so you can use them as examples.
- Open the "Configure -> Preferences" dialog box.
- Click the "Tools" item in the left list.
- Click the "Add" button and select "Menu Separator" to create a new section in your tools menu.
- Click the "Add" button and select "Program" to create a new tool. A file chooser box will pop-up.
Select any file. It doesn't matter, because we are going to change it anyway.
- Click "Apply" to save this option to your tools list.
- Double-click on the newly created item in your tools list and change it's name to "Compile JUnit".
- Click "Apply" to save this change.
- Click the "+" sign next to the "Tools" item in the left panel.
This will now display the newly added tool.
- Select "Compile Java" from the "Tools" menu and record the contents of the Command, Parameters and Initial Folder fields. We will use this information in the new tool.
- Select "Compile JUnit" from the "Tools" menu.
- Edit the Command, Parameters and Initial Folder so that it is the same you recorded from the "Compile Java" tool.
- Add the classpath information to the Parameters field. Note: In Windows, the drive is a letter
followed by a colon (:), the path separator is the semi-colon (;) and the directory separator is the
back-slash (\).
Example for including the current working directory and junit.jar if it's been installed in
the c:\junit3.8.1 directory:
-classpath ".;c:\junit3.8.1\junit.jar"
- Click "Apply" to save the changes.
- Click "OK" to save and exit the configuration menu and try compiling a JUnit TestCase class.
Your "Tools" menu should now resemble this:
To add a "Run JUnit" option to your "Tools" menu in TextPad
- Repeat the above steps for adding a "Run JUnit" option to your "Tools" menu.
Note: the classpath information is the same, but the run command must specify TestRunner
as the class to execute. Include this information in the Parameters field:
-classpath ".;c:\junit3.8.1\junit.jar" junit.textui.TestRunner $BaseName
or to use the GUI version:
-classpath ".;c:\junit3.8.1\junit.jar" junit.swingui.TestRunner $BaseName
|