Chapter 21. Packages and Packaging
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.[59] APIs
consist of one or more packages; packages consist of classes; 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 are shown in
Table 21-1.
Name | Function |
| Applets for browser use |
| Graphical User Interface |
| Reading and writing |
| Intrinsic classes (String, etc.) |
| 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) |
| Regular Expressions ... |
Get Java Cookbook, 3rd 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.