Using the command-line tools
JBuilder includes the following command-line tools:
The JDK includes the following command-line tools:
- javac - the compiler for the Java programming language.
- java - the launcher for the Java applications.
- jar - manages the Java Archive (JAR) files.
- javadoc - an API documentation comments extraction utility.
- appletviewer - allows you to run applets outside of the context of a web browser.
- native2ascii - converts a file of native encoded characters to one with Unicode escape sequences.
See also: Sun Tools documentation at http://java.sun.com/j2se/1.3/docs/tooldocs/tools.html.
Setting the class path for command-line tools
The class path tells Java tools where to find classes that are not part of the Java platform. You can set the path to the classes with the -classpath option or by setting the CLASSPATH
environment variable described in the following topic. The -classpath option temporarily overrides the CLASSPATH
environment variable for the current command-line session. It's best to use -classpath as you can set it for each application, and it does not affect other applications.
Directories listed in the classpath are separated by colons on the UNIX platform and by semicolons on the Windows platform. You should always include the system classes at the end of the path. The classpath is also used to search for sources if no sourcepath is specified.
For more information on class paths, see the Java documentation on "Setting the classpath."
For more information on the JBuilder IDE and class paths, see "How JBuilder constructs paths" and
"Where are my files?"
Using the -classpath option
UNIX: -classpath option
Use the -classpath option to temporarily set the path to your classes. The -classpath option takes the following form:
% jdkTool
-classpath path1:path2
Windows: -classpath option
Use the -classpath option to temporarily set the path to your classes. The -classpath option takes the following form:
C:>jdkTool
-classpath path1;path2
Setting the CLASSPATH environment variable for command-line tools
Usually, it's best to use the -classpath command-line option as it only temporarily overrides the classpath and does not interfere with other applications. However, there may be occasions when you want to set the CLASSPATH
environment variable.
For more information on the -classpath option and the CLASSPATH environment variable, see the Java documentation, "Setting the classpath."
UNIX: CLASSPATH environment variable
Viewing CLASSPATH
- Open a command-line shell window.
- View the current
CLASSPATH
environment using the following command-line format:
- in csh shell:
env
- in sh shell:
CLASSPATH
Setting CLASSPATH
To set your CLASSPATH
environment variable,
- Open a command-line shell window.
- Set the
CLASSPATH
environment using the following command-line format:
Clearing CLASSPATH
- Open a command-line shell window.
- clear the
CLASSPATH
environment variable using the following command-line format:
- in csh shell:
unsetenv CLASSPATH
- in sh shell:
unset CLASSPATH
Windows: CLASSPATH environment variable
Viewing CLASSPATH
Use the set command to view the current CLASSPATH.
C:> set
Setting CLASSPATH
To set your environment variables for the command line:
- Open a DOS window.
- Modify the CLASSPATH environment variable with the set command.
set CLASSPATH=path1;path2 ...
The paths must begin with the drive letter, for example C:\
.
Clearing CLASSPATH
If you need to clear your path, you can unset CLASSPATH as follows:
C:> set CLASSPATH=
This command unsets CLASSPATH for the current DOS session only. Be sure to delete or modify your startup settings to ensure that you have the right CLASSPATH settings in future sessions.
Changing Startup Settings
If the CLASSPATH variable is set at system startup, the place to look for it depends on your operating system.
- Windows 95 and 98: Edit the set command in the autoexec.bat file located at the root of C.
- Windows NT: Right-click the My Computer desktop icon and select Properties. Click the Environment tab and edit the CLASSPATH variable in the User Variables section.
- Windows 2000: Right-click the My Computer desktop icon and select Properties. Click the Advanced tab and press the Environment Variables button to edit the CLASSPATH variable in the User Variables section.
Setting the DOS environment space
You might get an Out Of Environment Space error when setting your path, because only a small amount of environment space is allocated by default.
To increase the DOS environment space:
- In the DOS window, click the control menu in the upper left, and choose Properties.
- Click the Memory tab to show the Memory options page.
- In the Initial Environment drop-down list, select a reasonably large value, such as 2048. The other settings on the page can be left at Auto.
- Click OK to close the Properties dialog, and type
exit
at the prompt, to quit the DOS session.
- Start a new DOS session.
Note: These instructions apply to Windows 95 and 98 only; they do not apply to Windows NT.