JHDL 0.3.45

| JHDL Doc Home Page | Getting Started Page | Setting The Classpath |


Setting up the Classpath for JHDL

Java source code files are compiled to Java byte code files called class files. The class files are what the Java virtual machine (JVM) interprets and executes as part of a Java program. The CLASSPATH environment variable tells the JVM's class loader where it should look for class files.

JHDL class files are usually stored in a Java archive (JAR) file. To use JHDL, you must have the JHDL JAR file in your classpath. This page shows how to do this on some major platforms. These instructions assume that you will be compiling JHDL designs and running them from a command line terminal or command prompt on your computer. Users of Linux, BSD, Solaris, MacOSX, or other variants of Unix should refer to the sections on either csh/tcsh or bash. Users of most Microsoft Windows operating systems should refer to the section on Microsoft Windows. Users of other systems should refer to documentation available for the operating system or the Java runtime environment for that system.

If you are using an integrated development environment (e.g. JBuilder, ProjectBuilder, etc.) to develop, compile, and run JHDL designs, you should read documentation specific to your development environment to learn how to include the JHDL JAR in the CLASSPATH of you environment.

  1. Linux/Unix: csh/tcsh
  2. Linux/Unix: bash
  3. Microsoft Windows

Setting Classpath for Linux/Unix platforms running using csh or tcsh

csh and tcsh are command language interpreters typically run from within terminals on Linux or Unix machines. To see if you are using the csh or tcsh shell, you might try running the command

      echo $SHELL

For a temporary inclusion of the JHDL jar to your classpath, you can run the following command:

      setenv CLASSPATH /path/to/jhdl/jar/JHDL.jar:.

where /path/to/jhdl/jar is the directory path to the location where you saved the JHDL.jar. The colon is used to separate elements of the CLASSPATH and the . will include the current directory (whatever it happens to be at any time after you set the CLASSPATH) in the CLASSPATH. If you already have a CLASSPATH variable set and would like to use its current values as well, you can run the following command:

      setenv CLASSPATH "$CLASSPATH":/path/to/jhdl/jar/JHDL.jar

This setting will persist for the duration of the shell session in which the setting is made.

To set up your shell so that the classpath is set every time you start a new shell, you should edit your .cshrc, .tcshrc, or other relevant initialization file. (NOTE: You may need to create this file if it doesn't already exist.) If your initialization file already sets the CLASSPATH, simply add :/path/to/jhdl/jar/JHDL.jar to the end of the setting. If it does not already set the CLASSPATH variable, insert the full setting as follows:

      setenv CLASSPATH /path/to/jhdl/jar/JHDL.jar:.

Setting Classpath for Linux/Unix platforms running using bash

bash is command language interpreter typically run from within terminals on Linux or Unix machines. To see if you are using the bash shell, you might try running the command

      echo $SHELL

For a temporary addition of the JHDL jar to your classpath, you can run the following command:

      export CLASSPATH=$CLASSPATH:/path/to/jhdl/jar/JHDL.jar

where /path/to/jhdl/jar is the directory path to the location where you saved the JHDL.jar This setting will persist for the duration of the shell session in which the setting is made. You should make sure that the original $CLASSPATH variable includes . so that the current directory is always included in the CLASSPATH.

To set up your shell so that the classpath is set every time you start a new shell, you should edit your .profile, .bashrc, or other relevant initialization file. (NOTE: You may need to create this file if it doesn't already exist.) If your initialization file already sets the CLASSPATH, simply add :/path/to/jhdl/jar/JHDL.jar to the end of the setting. If it does not already set the CLASSPATH variable, insert the full setting as follows:

      export CLASSPATH=/path/to/jhdl/jar/JHDL.jar:.

Setting Classpath for Microsoft Windows platforms

For a temporary addition of the JHDL jar to your classpath, you can run the following command from the command prompt:

      set CLASSPATH=%CLASSPATH%;DRIVE:\path\to\jhdl\jar\JHDL.jar

where DRIVE:\path\to\jhdl\jar\ is the directory path to the location where you saved the JHDL.jar This setting will persist for the duration of the command prompt session in which the setting is made and is valid only for the command prompt from which the setting is made. You should make sure that the original %CLASSPATH% variable includes . so that the current directory is always included in the CLASSPATH.

To set up your environment so that the CLASSPATH is set all of the time, you should set it in the system environment and variables section of the Control Panels.


jhdl@ee.byu.edu
Last modified: 11 May 2006 3:30pm MDT