You can choose download the JDK installation file in one piece, or in a number of smaller pieces (floppy size). If you have downloaded the installation file, you can begin the installation process by double clicking on the icon of the file. We suggest you to download in one piece.
2) When asked for how much you want to install all you really need is the Program Files, but if you have the space available, you should install all the components.
2) Open the c:\autoexec.bat file in a text editor.
3) Make the PATH equal whatever was the current value followed by C:\JDK1.3.1\bin;.
(Note: it will depend on the version of jdk. If you installed different
version, change the jdk1.3.1 to the version that you have installed. Example:
C:\jdk1.3\bin; or C:\jdk1.1.8\bin;)
4) Now, you need to Save the autoexec.bat file. Next, you need to restart your machine.
5) To make sure you have correctly modified the path, simply print out
your path information again, by typing "path" at the command prompt. Your
new path should include the "C:\jdk1.3.1\bin" directory, as in the picture
below. As a final test to make sure everything has been installed correctly,
type "javac" at the command prompt:
If you get the output message "Bad command or file name", then your
path has not been modified correctly. If you get the output "Usage: javac
<options> <sourcefiles>" followed by a list of possible options as
in the screen shot above, then everything is correctly installed, and you
are ready to start developing Java programs on your PC!
Note: If you are running Windows NT / 2000, then to modify your path you should start the Control Panel, select System, select Environment, and look for "Path" in the User Variables and System Variables. Add the directory C:\jdk1.3.1\bin to the right hand end of the "Path" variable.
-or-
C:> set CLASSPATH=path1;path2...
where:
sdkTool
A command-line tool, such as java, javac, or javadoc. For a listing,
see SDK Tools.
path1;path2
Paths to the .jar, .zip or .class files. Each path should end with
a filename or directory depending on what you are setting the class path
to:
Classes can be stored either in directories (folders) or in archive
files.
Multiple path entries are separated by semi-colons. With the set command, it's important to omit spaces from around the equals sign (=).
The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
Classpath entries that are not either a directory or an archive (.zip
or .jar file) are ignored.
I will use the example given by the text book (Java Structures: Data Structures in Java for the Principled Programmer Duane A. Bailey) They provide java files with a named package called structure. Also, the working directory is called "course" under C drive.
Features:
C:> set CLASSPATH=.;C:\structure.jar;
Now, you can compile and run any application (Test.java) at any directories.
Note: You don't need to extract all the files from the structure.jar file and it works in application.
Features:
C:> set CLASSPATH=.;C:\structure.zip;
Now, you can also compile and run any application (Test.java) at any directories.
Note: same as example 1, you don't need to extract all files from the structure.zip file.
Features:
2) You need to set up your classpath so that you can compile the source code. Type the following command in DOS.
C:> set CLASSPATH=.;C:\course\structure.jar;
3) Compile your file (TestApplet.java)
4) Create html file to load your applet. You must put "ARCHIVE" tag in your html file. Download the TestApplet.html from here.
<html>
<body>
<applet code="TestApplet.class" ARCHIVE="structure.jar" width=200
height=200></applet>
</body>
</html>
5) Now you can run the applet.
Features:
Therefore, the steps are:
1) Download the structure.jar file and save in "C:\jdk1.3\jre\lib\ext" folder.
2) Compile your source code (Test.java file).
3) Create a html file .
<applet code="TestApplet.class" width=200 height=200></applet>
4) Run your applet.
Note: You don't need to set up the classpath for applet.
Features:
JAR files are cross-platform archives that can hold an arbitrary number of files, and are used mostly to store .class files and auxiliary files such as image and audio files. The java tools understand JAR file format and automatically extract what they need. To create a JAR file, use the jar command, which is reminiscent of the Unix tar command, and the following options as needed:
c create jar file
t list table of contents
x extract files
u update
v verbose output
f use file instead of standard
input/output
m read manifest file
0 (the numeral zero) turn
off
compression (for faster
loading)
M skip manifest
C change directory (don't
include path names
in output)
To create a JAR file for structure files in c:\structure, you would execute the following command from c:\:
jar cvf structure.jar structure\*.class