How to Set CLASSPATH for Java Tools
    Main Page
    Lab Hardware
    Lab Software
 

Last updated: 6 Oct 2009

Many Java-related tools are available to use. They are distributed as Java .jar (Java Archive) files, and on Windows can be found in this directory:

G:\javatools

You can use these tools by setting your classpath environment variable to refer to the the current directory (".") and the directory containing the tool. You may also find help here for setting up Eclipse to use jar files.

The current list of tools is (some have several jar files in the directory):

  1. ant

    Class Path:

    G:\javatools\apache-ant-1.7.0\lib\ant.jar
    
  2. HttpUnit

    Class Path:

    G:\javatools\httpunit-1.6.2\lib\httpunit.jar
    
  3. JUnit

    Class Path:

    G:\javatools\junit4.4\junit-4.4.jar
    
  4. Xalan-Java

    Class Path:

    G:\javatools\xalan-j_2_7_0\xalan.jar;G:\javatools\xalan-j_2_7_0\xml-apis.jar
    
  5. Xerces-Java

    Class Path:

    G:\javatools\xerces-2_9_0\xercesImpl.jar;G:\javatools\xerces-2_9_0\xml-apis.jar
    
  6. JOGL: Java Bindings for OpenGL -1.1.1

    Class Path:

    G:\javatools\jogl-1.1.1-windows-i586\lib\jogl.jar
    

    If you want to run the demos, you will need to add to your classpath:

    • G:\javatools\jogl-demos\jogl-demos*.jar
    • G:\javatools\jogl-1.1.1-windows-i586\lib\gluegen-rt.jar

    Setting your classpath to run the demos would look like this:

    set classpath=.;G:\javatools\jogl-demos\jogl-demos-data.jar;G:\javatools\jogl-demos\jogl-demos-util.jar;G:\javatools\jogl-demos\jogl-demos.jar;G:\javatools\jogl-1.1.1-windows-i586\lib\jogl.jar;G:\javatools\jogl-1.1.1-windows-i586\lib\gluegen-rt.jar
    

    The JOGL binary files (.dll files) must be in your command PATH -- they are by default in the general development labs. If not, here is how you could set the PATH environment variable for the current command/DOS prompt:

    set path=%path%;g:\javatools
    

    To set up Eclipse in the labs to use JOGL (thanks to student Wilfredo Ortiz and Dr. Isabelle Bichindaritz):

    1. add jogl.jar and gluegen-rt.jar as indicated above:

      This first step allows compilation to occur.

      1. right-click on your project
      2. select Properties
      3. select Java Build Path
      4. select Libraries
      5. select Add Library
      6. select User Libraries
      7. click New ...
      8. enter a name such as jogl
      9. click Add JARs ...
      10. browse to folder
        G:\javatools\jogl-1.1.1-windows-i586\lib
              
      11. select the two jars jogl.jar and gluegen-rt.jar
      12. click OK then Apply
    2. To run a program
      1. select Run Configuration
      2. select Arguments
      3. select VM arguments
      4. add the following line:
        -Djava.library.path=G:\javatools\jogl-1.1.1-windows-i586\lib
              
  7. JMonkey Engine

    To use this in Eclipse:

    1. Add the jME JARs to your projects build path
      1. right-click on your project
      2. select Properties
      3. select Java Build Path
      4. click Libraries tab
      5. click Add Library button
      6. select User Library
      7. click User Libraries button
      8. click New... button
      9. enter jme for User library name
      10. select jme
      11. click Add JARs...
      12. browse to the folder G:\javatools\jme
      13. select all the JAR files and click Open button
      14. click OKs and ultimately click the Finish button
    2. If you will be using lwjgl.jar:
      1. expand jme
      2. right-click on lwjgl.jar
      3. select Properties
      4. select Native Library
      5. click External Folder... button
      6. browse to G:\javatools\jme
      7. click OK button
      8. click Apply button
      9. click OK button

    Using the CLASSPATH Environment Variable

    If you use a particular set of classes from one or more jar files regularly, it is convenient to set your CLASSPATH environment variable once, log off, then any time afterwards, you just need to invoke javac or java without specifying the -classpath option (as illustrated in later sections).

    • For Windows XP:
      1. Right-click on the My Computer icon
      2. Select Properties
      3. Click on the Advanced tab
      4. Click on the Environment Variables button
      5. Create a new or edit the old CLASSPATH variable for your login account
      6. Add this as a value:
          .;PATH
          

        where "." represents the current directory, and PATH represents the full path to the jar files you want.

      7. Click on OK buttons until you have closed the Properties.
      8. Log off, then log back on to ensure that your environment variables are set.

    Windows Compilation Instructions

    On the Windows workstations, substitute the class paths to the jar files above for the word "PATH" below.

    1. From a DOS Prompt:
        javac -classpath .;PATH myfile.java
        

      The period (".") represents the current directory, the semicolon (";") separates paths, and PATH is the collection of Java Archive files that contain the required classes.

    2. From TextPad:

      You will need to change the default configuration for compiling a Java program. From the Configure menu, select Preferences, then click on Tools to expand the list. You should see "Compile Java" -- click on this to see the settings.

      In the box called "Parameters", type:

        -classpath .;PATH $File
        

      then click on the OK button to save the settings.

    Windows Execution Instructions

    On the Windows workstations, substitute the paths to the jar files above for PATH below.

    To refer to particular Java archive files when executing a Java program that includes a reference to them, you must add the path to your classpath, as follows:

    1. From a DOS Prompt:
        java -classpath .;PATH myfile
        

      The period (".") represents the current directory, the semicolon (";") separates paths, and PATH is the collection of Java Archive files that contain the required runtime classes.

    2. From TextPad:

      You will need to change the default configuration for running a Java program. From the Configure menu, select Preferences, then click on Tools to expand the list. You should see Run Java Application — click on this to see the settings.

      In the box called Parameters, type:

        -classpath .;PATH $Basename
        

      then click on the OK button to save the settings.

    Change Log

    6 Oct 2009 Updated link for JOGL
    1 Oct 2009 Updated JOGL for 1.1.1a, then realized it puts files in old 1.1.1 folder
    2 Oct 2008 Updated JOGL documentation for use in Eclipse
    25 Sep 2008 Added documentation for JMonkeyEngine
    23 Sep 2008 Updated documentation for JOGL 1.1.1
    11 Sep 2007 Updated documentation for latest versions of tools
    21 Dec 2005 Updated information; added CLASSPATH environment variable section and jogl tool spec
    23 Jan 2003 Original File



    Hours  |  Support Information  |  News  | 
    Policies  |  Emergencies