JDK Commander
User's Guide
Version 25-August-2000
The installation has been simplified to almost zero: JDK Commander is distributed as an immediately executable program. The following must be done:
The control panel is the display that you usually get when you start JDK Commander. Generally speaking, JDK Commander always starts by displaying the control panel, unless it doesn't have a valid set of configuration data. Therefore, when you start JDK Commander for the first time, you will not see this control panel, but rather the configuration menu.
This is what the control panel looks like. Click
on an area of the picture about which you want to know more.
The control panel has 3 control groups:
The javac button calls the JDK javac compiler to compile the currently selected source file. See below how to select a source file. When javac has finished, you either see nothing (except that the mouse pointer changes from hourglass to normal) or an editor window appears that displays diagnostics generated by javac. No editor window means no diagnostics which means a successful compilation. However, you will also get a diagnostics display of a compilation without errors if the compilation option -verbose is selected.
You can select compilation options in the javac configuration menu.
See the tools configuration menu for more details about the editor window that displays diagnostics.
The Edit button calls the editor. If an existing source file is selected (see below how to select a source file), the editor will be called to open this file. If no file is selected, the editor is called without opening any file, so you can create a new one.
Selecting an existing source file: There are two ways to select a source file. You can press the Browse button to open a file dialog and select a file by opening it in the dialog. As a result, the file name and the complete path will be displayed in the edit control below the Browse button. The second way is directly entering the file name and its path in the edit control, or modifying a file specification that is displayed in it.
A hint for when you work on a moderately complex project with multiple related source files: You can start multiple instances of JDK Commander and select a different source file in each instance. Then you can edit and/or compile a particular java file by simply pressing a single button without going through a file navigation/selection.
Source files that JDK Commander can process: Source files are basically text files. JDK Commander works for files created in Windows/DOS, UNIX and Mac environments (They differ in the way lines are separated. Not every editor will handle all formats.).
javac accepts only files that contain not more than one class with the attribute public. This restriction is based on the fact that javac creates one class file per java file and on the runtime binding mechanism of java that relies on class file names being identical to the name of the public class they contain. For reasons of compatibility with some other java development tools, JDK Commander also accepts source files with multiple public classes. JDK Commander makes these files acceptable to javac by splitting them up into smaller temporary source files containing one class each. Therefore, the result of a javac compilation may be multiple class files. This approach has some side effects:
Before you can execute a program, you must select a .class file. There are two ways to select a class file. You can press the Browse button to open a file dialog and select a file by opening it in the dialog. As a result, the file name and the complete path will be displayed in the edit control below the Browse button. The second way is directly entering the file name and its path in the edit control, or modifying a file specification that is displayed in it. Also use the edit control for runtime arguments.
The java button starts the execution of the currently selected class file. You can select java execution options in the java configuration menu. When you press the java button, a new window will appear (in addition to the ones your application may create). This window handles the java I/O streams System.in, System.out and System.err. That is, if you want to type input to your application, you type it into this java streams window. If your application writes to System.out and/or System.err, the output will appear in this window. The streams are distinguishable by individual colors as shown by the following example:
It is also possible that these two lines appear as one single line on your PC. This is dependent on internal timing conditions. The java virtual machine writes independently the following to two buffered streams:
Then the little java program expects you to type
a line (e.g.
This is keyboard input to System.in) and terminate
it with the Enter key. This results in the following display:
You can see here that System.out is blue, System.err is red and System.in is black. In addition, there is a green line that is displayed after the java program terminates. The window will disappear when you press any key or close it by clicking on the top right corner.
The window's file menu shown below offers the following:
Some programs require runtime
arguments. For instance, if you write an application that replaces
all tabs in a text file by spaces, you would supply the name of the text
file as an argument and access it in the program via the main(String[]
args) mechanism. You can supply runtime arguments
by typing them directly in the edit control for class
file selection after the file name. Here is an example. First press
Browse to select a class file. You may get something like this:
Next, you manually append the runtime argument to the class file specification:
Finally press java to run the application.
The jdb button starts the execution of the currently selected class file under control of the JDK debugger. Otherwise it is just like java (except that you can't use the -v option).
! Note
that jdb versions earlier than JDK 1.3 require you to have a connection
to the internet while jdb is initializing. Otherwise jdb hangs. I have
always considered this very annoying. But with JDK 1.3, this has changed
(and a few other quirks have also disappeared). So, if you want to do debugging,
I strongly suggest to not use any JDK less than version 1.3!
Note that the appletviewer may require an online
connection to the internet for starting properly. This seems to be somehow
related to jdb: With JDK 1.3 I can run appletviewer
completely offline.
When you start JDK Commander for the first time, you will first see its configuration menu. In addition, whenever JDK Commander thinks that the configuration data available to it are not sufficient, it will display the configuration menu.
This is what the configuration menu looks like. Each tab is shown (with its default settings) and briefly explained:
The Tools common parameters tab has common definitions for the collection of tools that are included in the JDK. The most important component here is the Tools .exe directory parameter. Here you inform JDK Commander where the file javac.exe (the javac compiler) is located. You do this by navigating through the file menu that opens when you press Browse, or by entering the file specification directly in the edit control. JDK Commander then expects to find the other JDK executables (java, appletviewer ....) in the same directory.
I suggest not to put JDK Commander in the same directory as Sun's JDK executables.
For a description of the four path settings see the JDK documentation. The paths consist basically of a list of directories which JDK Commander lets you compose by means of the Add and Clear buttons. With every Add you get a dialog where you can select one directory. When you press Add again, the selected direcory is added to the list that you see in the edit control. With Clear you can wipe out the entire list. Of course you can manually edit the contents of the edit box.
You can then choose how you want diagnostics displayed.
This applies to diagnostics from both javac and appletviewer. By default,
the Windows Notepad displays them, but you can choose your sourcecode
editor to be called for displaying the diagnostics.
The individual configurations box is common to all configuration tabs. It permits saving and restoring complete configurations and referring to them by name. Although the current configuration is always saved as the default, you may wish to keep different settings that you can restore easily.
If you want to save your current configuration settings simply as the default settings, press OK. If you want to save them as a named configuration, press Save to open a file save dialog.
When you want to reload a named configuration later on: Open the configuration menu from the control panel, then press the Load button in the individual configurations group to open a file dialog.
Possible uses for this feature are
The javac configuration tab is for parameters that are related to javac only. The Sound checkboxes control an acoustic signal that may be turned on for an audible notification of the end of a javac compilation. For an explanation of the other parameters consult the JDK documentation.
Just a comment to the target controls: The default (as shown in the above screen shot) is other with an empty edit box. The result of this is that JDK Commander will call javac with no target option at all, so that javac will apply its default. You could however enter something in the edit box, although there is currently nothing meaningful you could do. But I have added it to be open-ended: If you use JDK Commander in 20 years with JDK version 98.7, you may well wish to specify some target option.
I encourage you to use the target option, so you
get the benefits of the latest virtual machines.
The java configuration
tab contains no JDK Commander specific controls. They are all related to
JDK's java. For a description consult the JDK
documentation. The settings shown above are the defaults chosen by
JDK Commander. Just a remark to the jdb launch option: This is the
-launch
option described in the JDK documentation in the section on jdb. I decided
to not create a separate jdb configuration sheet, so you find the option
here. Also note that this option is not available in JDK releases less
than 1.3!
The appletviewer
configuration tab contains no JDK Commander specific controls. They
are all related to JDK's appletviewer. For a description consult the JDK
documentation.
The sourcecode
editor tab is for the definition of the editor you want to use for
editing your java source files. JDK Commander does not come with its own
editor, but you can plug-in your favorite editor. If you don't have one,
you can work with the standard Windows Notepad by checking the Notepad
checkbox in this control group. If you check the 'some other editor'
box, you must tell JDK Commander which executable to start. You do this
by either entering the full path and name in the edit control or by navigating
in the file menu that opens when you press the Browse button.
JDK Commander supports editors that are either Win32
executable files (.exe) or java archives (.jar).
Note that the default configuration settings are inconsistent: They indicate to use some other editor, but have no file specification. This has been done intentionally to force new users to take a look at the configuration. You must either select Notepad or specify the path to your preferred editor.
If you are not sure about which editor to use, I have three suggestions. They are very different, and each may serve as an example for many similar ones:
The first box (java files) lets
you select java source files. Besides entering them manually, you can select
them by means of the Add and Clear
buttons. With Add you get a file dialog that lets you select
multiple
files from a single directory. When you press Add again, another
file dialog opens, and you can select more files from another directory.
These will be added to the list of java files. Clear wipes out all
files that are currently listed in the edit control.
Note that you can manually enter things
like *.java. This will usually work if the files are at a location included
in the sourcepath.
If your sourcepath contains directory
names with embedded blanks, javadoc will probably not accept them. If you
insist on using embedded blanks, use the file dialog selection.
The second box (packages) lets you
manually enter packages. You might as well type in here java source file
names because on the command line that JDK Commander will set up internally,
packages and java files can appear in any order. There is a special box
here for packages to make a clear distinction between files selectable
by dialog and other input.
Please consult the JDK documentation (section javadoc options) for an explanation what these options mean. Just let me add the following JDK Commander specific details:
Here you can enter javadoc options not directly related to files. Again, consult the JDK documentation (section javadoc options) for an explanation of these options.
The field doclet options is not
described in the JDK documentation. You can type in here any sort of additional
arguments. The main purpose of this is to provide a means of specifying
arguments that are input to a user written doclet. If you don't have your
own doclet, leave the doclet options field empty. The following option
tabs are provided for specifying options to the standard doclet.
This panel is for options related to the
standard doclet. For an explanation, consult the JDK documentation (section
Options
Provided by the Standard Doclet).
The destination control lets you
select a directory where javadoc will store its results. This destination
option is independent of the javac destination option which you can set
in the main configuration menu.
These are more options for the standard
doclet. I have nothing to add to the JDK documentation.
This is what the jar menu looks like (at
least when you open it for the first time). You will find a few controls
that are enabled, and quite a few more that are disabled (greyed out).
However, they will become enabled as you enter parameters.
On this menu, the controls are arranged for a top-to-bottom click order.
First, select an archive, either by creating a new one or opening an existing one for update. The respective buttons are in the top left corner.
Optionally, select your own manifest file. Consult the JDK documentation for more information on manifest files.
Not optional: The base folder. This is the folder from where jar will start collecting files. In the JDK documentation, this corresponds to the default directory from where you would call jar if you used the DOS command line.
As soon as JDK Commander has an archive file specification and a base folder, it will enable the dialog items for selecting files to include in the archive. Now you can
This will include all class files in the
base folder.
This screen shot shows you also that the
button at the bottom to the left of the Cancel button is a "polymorphic"
button: Its text changes according to the circumstances. While the button's
text in the first screen shot was Run jar
(it was disabled there), it is now Create archive because (in this
particular case) JDK Commander knows that the user wants a new archive
to be created. If you pressed the Update existing archive button
at the top, the text of the button at the bottom would now read Update
archive. Whatever it says, this is the button that will close this
dialog window and start jar with all your parameters. If you want to see
the jar command line generated by JDK Commander: Check the verbose
checkbox!
To the left of this polymorphic Run button, there is the Create index button. It is only enabled when you select an existing archive for update. If you press it, jar will be started with the -i option (see JDK documentation) to create an index in the archive. All input file selections are ignored in this case. Note that this function is not available in JDK versions less than 1.3. JDK Commander does not know what JDK version you are using and will not protect you from a jar error if you try creating an index with an older JDK release.
There are two more things in this dialog I want to mention:
The Select subfolders item lets you chose folders located in the base folder that you want included recursively in the archive. You can either add all of them (and then manually wipe out the ones you don't want) or add one by one using the Add button. If you consider using this feature: Maybe the "Add all files including all subfolders" checkbox is a quicker approach to what you need.
Finally, there is the checkbox Open jar archive as zip after jar operation at the bottom left. When this is checked, JDK Commander will, after having run jar, start your zip program to open the jar archive. I have tested this feature only with WinZip. I don't know how well this works with other zip programs. This feature will present your archive with your favorite archive utility that lets you inspect the contents and delete unwanted files. (In fact, I have chosen this approach to avoid reinventing the wheel. I can hardly do better than WinZip.)
If the zip checkbox is disabled (greyed
out), this means that JDK Commander has examined your system and was not
able to locate a program for opening zip archives. Check your zip utility
installation!