Chapter 15. Packages and Packaging
15.0 Introduction
One of the better aspects of the Java language is that it has defined
a very clear packaging mechanism for categorizing and managing its large
API. Contrast this with most other languages, where
symbols may be found in the C library itself or in any of dozens
of other libraries, with no clearly defined naming
conventions.1 APIs
consist of one or more package, packages consist of classes, and classes
consist of methods and fields. Anybody can create a package, with
one important restriction: you or I cannot create a package whose
name begins with the four letters java
. Packages named java
.
or javax
. are reserved for use by Oracle’s Java developers,
under the management of the Java Community Process (JCP).
When Java was new, there were about a dozen packages in a structure
that is very much still with us, though it has quadrupled in size;
some of these packages are shown in
Table 15-1.
Name | Function |
---|---|
|
Graphical user interface |
|
Reading and writing |
|
Intrinsic classes ( |
|
Library support for annotation processing |
|
Math library |
|
Networking (sockets) |
|
“New” I/O (not new anymore): channel-based I/O |
|
Java database connectivity |
|
Handling and formatting/parsing dates, numbers, messages |
|
Java 8: modern date/time API (JSR-311) |
|
Utilities (collections, date) ... |
Get Java Cookbook, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.