CIS 4930 (Programming in Java):
Java Tips
General instructions for using the JDK (Java Development Kit)
- Use any text editor to enter the source code for
your program. Save the Java source as
*.java and
the HTML source (for an applet) as
*.html.
Note that the name of the .java file
must be the same as the name of the public class it
contains
(e.g., the name of the file containing public class
hello must be hello.java).
- Use javac to compile programs
(e.g., javac hello.java).
- Use java to execute a stand-alone program
(e.g., java hello).
- Use appletviewer to execute an applet
(e.g., appletviewer hello.html).
(You can also try using your favorite browser,
but be warned that many do not yet support all the
features of Java 1.1.)
- See the online documentation for more details. A copy should
be loaded onto the system you are using as part of the
installation process (see the system-specific instructions
below for details), or you can browse it at
Sun's Web site.
This documentation describes the compiler and
other tools and includes a complete API for Java's
core classes.
System-specific instructions
Using the JDK on the CIRCA machines (Windows 95)
- Open a DOS prompt. It is more convenient to use DOS in
a window rather than the whole screen. Control-Alt will
switch DOS to a window.
- Type the command jdk. This sets the path and
classpath correctly.
- Proceed as above. Note that some text editors append
.txt
to the end of the file name. If this happens, the Java
compiler will not be able to find the file.
The editors pfe and notepad with
"all files" selected seem to be able to save files without
the .txt suffix. If all else fails, use a DOS
or Windows command to rename your file.
- Online documentation was once available in file
N:\win95\JDK-113\index.doc;
clicking on the file name would
open a web browser displaying the
documentation for you to browse.
This documentation seems to have disappeared.
Check with the CIRCA support staff if this is a concern,
or ask us to do us.
Using the JDK on the CISE Unix machines
- Proceed as above.
Available text editors include vi and emacs.
(Previously, it was necessary to add
/local/java/bin to your path to access the
Java compiler, etc.; they now appear to be installed in
/local/bin, so no changes to your path should be
needed.)
- Online documentation is available in file
/local/java/docs/index.html;
pointing your browser at
file:/local/java/docs/index.html will display it.
Using the JDK on your own computer
- Follow the instructions on
Sun's Web page to download and install the current
release of the JDK. Note that you must download
documentation separately, but it's probably worthwhile to
do so, since the core API specification is included.
Approximate sizes are 9.7M for the JDK and 3.3M for the
documentation.
- Proceed as above.
- See the installation instructions for instructions on how to
access the online documentation.