Java Reference
In-Depth Information
369
Step 3 Make a subdirectory from the base directory that matches your package
name.
The subdirectory must be contained in your base directory. Each segment must
match a segment of the package name. For example,
mkdir /home/walters/homework1
If you have multiple segments, build them up one by one:
mkdir c:\cs1\edu
mkdir c:\cs1\edu\sjsu
mkdir c:\cs1\edu\sjsu\cs
mkdir c:\cs1\edu\sjsu\cs\walters
mkdir c:\cs1\edu\sjsu\cs\walters\homework1
Step 4 Place your source files into the package subdirectory.
For example, if your homework consists of the files Tester.java and
Bank.java , then you place them into
/home/walters/homework1/Tester.java
/home/walters/homework1/Bank.java
or
c:\cs1\edu\sjsu\cs\walters\homework1\Tester.java
c:\cs1\edu\sjsu\cs\walters\homework1\Bank.java
Step 5 Use the package statement in each source file.
The first noncomment line of each file must be a package statement that lists the
name of the package, such as
package homework1;
or
package edu.sjsu.cs.walters.homework1;
Step 6 Compile your source files from the base directory.
Change to the base directory (from Step 2) to compile your files. For example,
Search WWH ::




Custom Search