SE450: Java Tools: general [31/41] ![]() ![]() ![]() |
You will need to download the Java tools to your computer and run the installer. The java tools will all be placed in a directory of your choosing (default is c:\j2sdk1.4.0_0x where x is the version you downloaded). This directory is your JAVA_HOME.
Every major operating system has what are known as environment variables and has a different way to set them. You will need to know how to do this on your computer in order to complete assignemnts and pass this class. It's very simple, but it seems to give a large number of people trouble.
With the JDK, you need to think about 3 main variables. Your PATH, your CLASSPATH, and JAVA_HOME. Your path is the set of directories where the OS looks for executable programs and scripts. This needs to include your JAVA_HOME's bin directory.
Setting an environment variable: On Windows:
set PATH=%PATH%;c:\j2sdk1.4.0_03\bin
On Unix (bash):
export PATH=$PATH:/usr/java/j2sdk1.4.0_03/bin
Note the path separator on Unix is ":", on Windows it is ";".
You can set an environment variable permanently on Windows by putting
it in your autoexec.bat (Windows 9x) or by setting it in your Sytem ->
Environment Variables Tab (Windows NT/2000/XP). You can always set up a
.bat file to set your environment and run it from a command shell. The
command shell on Windows 9x can be run by selecting Start -> Run ->
type command
in the Open box and click OK, or on
Windows NT/2000/XP by doing the same and typing cmd
.
In Unix (bash shell) you can put the PATH, etc in your ~/.profile or ~/.bash_profile.
Once the PATH is set up, you can run the SDK tools.
The classpath is the path where the java tools will look for compiled class files. If you are using any third party libraries, you will need to include them on the classpath. You will also need to include directories where compiled class files are located. To include an archive of class files (a jar or zip file), just include the path to the actual file. To include a directory, just include the directory where the files are located. If the files are in a package and their package structure is reflected in the filesystem, point to the directory that contains the "root" of the package structure