Notes on Java Tools

Contents

Installation: Textpad/Java/Ant/Junit
Installation: Setting System Variables in XP
Installation: Using Windows98
Installation: Using Ant with TEXTPAD
Installation: Download Ant and Junit Together
Installation: OSX

Installation: Textpad/Java/Ant/Junit

Optional. If you want a command line version of Junit, try the following:

Installation: Setting System Variables in XP

For example, this is how you change the JAVA_HOME variable for Java 1.5

start |
  settings |
    control panel |
      system |
        advanced |
          environment variables |
            system variables |
              new | (or modify)
                Variable Name: JAVA_HOME
                Variable Value: C:\Program Files\Java\jdk1.5.0

The settings I use are:

JAVA_HOME  C:\Program Files\Java\jdk1.5.0
CLASSPATH  .;C:\local\junit\junit.jar
PATH       (...);C:\local\apache-ant\bin;C:\local\bin

Do not delete anything from the PATH variable. Simply add the entry for ant to the end.

Installation: Using Windows98

In older versions of windows, you can set your system variables permanently by adding lines to the end of c:\autoexec.bat and restarting your computer. For example:

set PATH="%PATH%;C:\local\apache-ant\bin;C:\local\bin"

If DOS gives you the error "Out of environment space", then apply the solution found here: http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q230205&

If you are still having trouble, make directory names seven characters or less. For example, rename "c:\local\apache-ant" to "c:\local\ant".

In order to open the zip files, use WinZIP

Installation: Using Ant with TEXTPAD

Tom Wilczak has advice for using ant with textpad:

To run Ant, select it from the "Tools" menu while editing any project source file. The build.xml file may be in the same directory, or any ancestor directory.

To jump to the offending line on a compiler error, double click the second line of the error message. This works only for compiler errors and not for failed tests.

You can also configure the tools to run from your choice of keyboard shortcuts by selecting the Keyboard option in the preferences box, and selecting tools. The rest should be self explanatory.

Installation: Download Ant and Junit Together

You can also run ant/junit by doing the following:

Installation: OSX

Comments on OSX from WILLIAM PETULLO

An Ant/JUnit environment may be installed on Apple's Mac OS X using the Fink[1] project. Here are the basic steps:

Once installed, ant may be used from the command line just like with any other operating system.

Comments from Andrew Close:

Here's how to install ANT and JUnit on OS X:

1) download ANT & JUnit (they should auto unstuff themselves)

2) copy/move the ANT directory to /Developer/Java/J2EE

3) copy/move the JUnit directory to /Developer/Java/J2EE

4) create symlink for ANT: ln -s apache-ant-1.6.2 Ant

5) create symlink for JUnit: ln -s junit3.8.1 junit

6) update environment variables (I use bash, if you use another shell
   then update accordingly).

   in .bash_profile:

   export JAVA_HOME=/Library/Java/Home
   export ANT_HOME=/Developer/Java/J2EE/Ant
   export JUNIT_HOME=/Developer/Java/J2EE/junit
   export PATH=$PATH:$ANT_HOME/bin:

7) reset your shell: . .bash_profile

8) check your environment variables: env <enter>

9) test:
   $ java -version <enter>
     --> you should get your java version (should already be installed)
   $ ant -version <enter>
     --> you should get your ant version

10) to test JUnit change directories to where your homework assignment
    is.  the directory with a build.xml file that calls JUnit to be
    specific.

11) type: ant <enter>

12) project should build and tests should run...

this article might be a bit better than the instructions above: http://www.macdevcenter.com/pub/a/mac/2003/10/03/ant.html

and here's one that tells users how to integrate ANT with xCode: http://www.macdevcenter.com/pub/a/mac/2004/06/01/osx_java.html


Revised: 2004/10/05 16:29

This page is valid xhtml 1.0.