Welcome

Wednesday, January 24, 2007

Linux, Apache, MySQL & PHP (LAMP) Setup Guide

LAMP has become a defacto-standard around the web community in the recent years, here is a guide to help you set it up. LAMP is the combination of Linux + Apache + MySQL + PHP. You probably already have Linux up if you have come this far, if not you can get help setting it up throughout this site and on #LinuxHelp.net on DALnet.
Apache is the most popular web server on the net. It is very secure, fast, and reliable. There are may customizations you can make it, such as PHP support (which I am covering), CGI/Perl, SSL, SSI, ePerl, and even ASP. MySQL is the fastest RDBMS in the world. It is very good for web based applications as well. Many tools have been developed for MySQL with PHP, such as phpMyAdmin, a very good web based admin tool for MySQL, which can do anything your heart desires with MySQL.
PHP is an up and coming server-side scripting langauge. It was developed by Rasmus Lerdorf, and countless others. It is currently in version 3.0.12. It has many advantages over its competitors (ASP, Cold Fusion, Perl, Java, ...) , such as it is Object Oriented, embedded into HTML, very fast, cross-platform compatible, can run as an Apache Module, it is constantly updated and fixed, and it borrows the best features from many other langauges. Now that I have filled you with my propaganda, let's get started.
First of all, download the latest stable sources of Apache, MySQL, and PHP, you can find them at www.apache.org, http://www.mysql.com/, and http://www.php.net/, respectively. I would move them into /usr/local/src for consistancy, as well as making sure you get the tarball versions. Next, unpack them by typing:
tar -zxvf filename.tar.gz
Now, we are going to setup MySQL first cd into the mysql directory, maybe /usr/locl/src/mysql-3.23.41 Then configure it by typing:
./configure --prefix=/usr/local/mysql
This will put it in it's own directory, which I always put things in /usr/local as a standardization. Run the make command:
make
Run the make install command:
make install
Now it is installed. You need now to set it up. Add the MySQL Libraries to the ldconfig file:
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
Now have it cache all of the libraries:
ldconfig -v grep libmysqlclient
You should now see something returned like:
libmysqlclient.so.10 => libmysqlclient.so.10.0.0
Now have MySQL start at boot time:
echo "/usr/local/mysql/bin/safe_mysqld --skip-networking >> /dev/null &" >> /etc/rc.d/rc.local
Now you must make the initial databases the MySQL needs to run:
./scripts/mysql_install_db
Now start up the service daemon for MySQL:
/usr/local/mysql/bin/safe_mysqld --skip-networking >> /dev/null &
Now add it to the path:
PATH="$PATH:/usr/local/mysql/bin"
Now you should test MySQL:
mysqladmin version
This should give you back all kinds of info on MySQL. Now create a password for the SuperUser:
mysql -u root -p
It will then prompt your for a password:
Enter password:
And MySQL should be setup.
Now the next part is making the new Apache/PHP setup. If you are currently using Apache and have stuff that you would like to keep, do a backup on your data. Now blow away the old Apache, delete it by any means possible. Now change into the Apache source directory:
cd /usr/local/src/apache_X.X.X
Configure apache:
./configure --prefix=/usr/local/apache
Now change into the PHP source directory:
cd /usr/local/src/php-X.X.XX
And run the configuration of php to support MySQL and Apache:
./configure --with-apache=../apache_X.X.X --with-mysql=/usr/local/mysql
Now run the make command:
make
Now run the make install command:
make install
Now change back into the apache source directory:
cd ../apache_X.X.X
Now you have to reconfigure Apache, because we have added in the PHP Module. This will have it use the module you provided:
./configure --prefix=/usr/local/apache --activate-module=src/modules/php3/libphp3.a
This will configure it. Now you must run the the make and make install commands:
make
make install
There is a possibility that it will complain about not having an ANSII C compiler. If so, goto the FAQ on the http://www.php.net/ site. There are some common fixes there. If everything went well, you now have a few last minute setup processses to go through. Rename the http daemon:
mv /usr/local/apache/bin/httpd-X.X.X /usr/loacl/apache/bin/httpd
Now make a sybolic link and startup the http daemon:
ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd
/usr/sbin/httpd
Now that it is up, test and see the version information:
httpd -v
Now you have to add a couple of pieces of info to the apache configuration files. They are located i /usr/local/apache/conf/
pico httpd.conf
Find the AddType section and uncomment these lines:
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
This will make apache understand that it needs to pass these extensioned file to the php3 engine. Now find the DirectoryIndex section and add some info for php. It should look like this:
DirectoryIndex index.html index.phtml index.php index.phps
That should do it. Now restart the Apache http daemon:
killall -HUP httpd
Apache should be up with support for php. You can now add the phpMyAdmin tool that is found at http://www.phpwizard.net/ or anyting else you would like. Come find me in #LinuxHelp.net on DALnet and I will show a few things in php, also I will show you a cool version operation for php.

Linux System Administration


The Linux System Administrator's Guide
Version 0.9
Lars Wirzenius
<Email address removed by request>
Joanna Oja
<Current email address unknown>
Stephen Stafford
<stephen@clothcat.demon.co.uk.NOSPAM>
Alex Weeks
<draxeman@gmail.com.NOSPAM>

An introduction to system administration of a Linux system for novices.
Legal Notice
Table of Contents
About This Book
1. Acknowledgments
2. Revision History
3. Source and pre-formatted versions available
4. Typographical Conventions
1. Introduction
1.1. Linux or GNU/Linux, that is the question.
1.2. Trademarks
2. Overview of a Linux System
2.1. Various parts of an operating system
2.2. Important parts of the kernel
2.3. Major services in a UNIX system
3. Overview of the Directory Tree
3.1. Background
3.2. The root filesystem
3.3. The /etc directory
3.4. The /dev directory
3.5. The /usr filesystem.
3.6. The /var filesystem
3.7. The /proc filesystem
4. Hardware, Devices, and Tools
4.1. Hardware Utilities
4.2. Kernel Modules
5. Using Disks and Other Storage Media
5.1. Two kinds of devices
5.2. Hard disks
5.3. Storage Area Networks - Draft
5.4. Network Attached Storage - Draft
5.5. Floppies
5.6. CD-ROMs
5.7. Tapes
5.8. Formatting
5.9. Partitions
5.10. Filesystems
5.11. Disks without filesystems
5.12. Allocating disk space
6. Memory Management
6.1. What is virtual memory?
6.2. Creating a swap space
6.3. Using a swap space
6.4. Sharing swap spaces with other operating systems
6.5. Allocating swap space
6.6. The buffer cache
7. System Monitoring
7.1. System Resources
7.2. Filesystem Usage
7.3. Monitoring Users
8. Boots And Shutdowns
8.1. An overview of boots and shutdowns
8.2. The boot process in closer look
8.3. More about shutdowns
8.4. Rebooting
8.5. Single user mode
8.6. Emergency boot floppies
9. init
9.1. init comes first
9.2. Configuring init to start getty: the /etc/inittab file
9.3. Run levels
9.4. Special configuration in /etc/inittab
9.5. Booting in single user mode
10. Logging In And Out
10.1. Logins via terminals
10.2. Logins via the network
10.3. What login does
10.4. X and xdm
10.5. Access control
10.6. Shell startup
11. Managing user accounts
11.1. What's an account?
11.2. Creating a user
11.3. Changing user properties
11.4. Removing a user
11.5. Disabling a user temporarily
12. Backups
12.1. On the importance of being backed up
12.2. Selecting the backup medium
12.3. Selecting the backup tool
12.4. Simple backups
12.5. Multilevel backups
12.6. What to back up
12.7. Compressed backups
13. Task Automation --To Be Added
14. Keeping Time
14.1. The concept of localtime
14.2. The hardware and software clocks
14.3. Showing and setting time
14.4. When the clock is wrong
14.5. NTP - Network Time Protocol
14.6. Basic NTP configuration
14.7. NTP Toolkit
14.8. Some known NTP servers
14.9. NTP Links
15. System Logs --To Be Added
16. System Updates --To Be Added
17. The Linux Kernel Source
18. Finding Help
18.1. Newsgroups and Mailing Lists
18.2. IRC
A. GNU Free Documentation License
A.1. PREAMBLE
A.2. APPLICABILITY AND DEFINITIONS
A.3. VERBATIM COPYING
A.4. COPYING IN QUANTITY
A.5. MODIFICATIONS
A.6. COMBINING DOCUMENTS
A.7. COLLECTIONS OF DOCUMENTS
A.8. AGGREGATION WITH INDEPENDENT WORKS
A.9. TRANSLATION
A.10. TERMINATION
A.11. FUTURE REVISIONS OF THIS LICENSE
A.12. ADDENDUM: How to use this License for your documents
Glossary (DRAFT, but not for long hopefully)
Index-Draft
List of Tables
5-1. Comparing Filesystem Features
5-2. Sizes
5-3. My Partitions
9-1. Run level numbers
12-1. Efficient backup scheme using many backup levels
List of Figures
2-1. Some of the more important parts of the Linux kernel
3-1. Parts of a Unix directory tree. Dashed lines indicate partition limits.
5-1. A schematic picture of a hard disk.
5-2. A sample hard disk partitioning.
5-3. Three separate filesystems.
5-4. /home and /usr have been mounted.
10-1. Logins via terminals: the interaction of init, getty, login, and the shell.
12-1. A sample multilevel backup schedule.


Next


About This Book

Linux HOW TOs


LDP HOWTO-INDEX
Guylhem Aznar
Joshua Drake
Greg Ferguson
v9.0, 2005-12-29

This document contains an index to the Linux HOWTOs as well as other information about the HOWTO project.
Table of Contents
1. What Are Linux HOWTOs?
2. Where Can I Get Linux HOWTOs?
3. HOWTO Translations
4. Categorized List of HOWTOs
4.1. The Linux OS
4.1.1. Getting Started
4.1.2. Switching from Other Operating Systems
4.1.3. Distributions
4.1.4. Installation
4.1.5. Kernel
4.1.6. Boot Loaders and Booting the OS
4.1.7. Parallel Processing
4.1.8. Partitions and Filesystems
4.1.9. RAID
4.1.10. Printing
4.1.11. Shell
4.1.12. Using Linux
4.2. System Administration and Configuration
4.2.1. Configuration / Installation
4.2.2. Benchmarking
4.2.3. Clustering
4.2.4. Backup
4.2.5. Recovery
4.2.6. Security
4.3. Hardware
4.3.1. General
4.3.2. Platforms
4.3.3. Video Cards
4.3.4. CPUs / Architectures
4.3.5. CD-ROM / DVD-ROM Drives
4.3.6. Optical Disks
4.3.7. Keyboard and Console
4.3.8. Digital Cameras
4.3.9. Graphic Tablets
4.3.10. Diskettes
4.3.11. Hard Disks
4.3.12. Jaz and ZIP Drives
4.3.13. Mice
4.3.14. Modems
4.3.15. Printers / Scanners
4.3.16. Routers
4.3.17. SCSI
4.3.18. Serial Ports
4.3.19. Sound Cards
4.3.20. Tape Drives
4.3.21. Touchscreens
4.3.22. UPS
4.3.23. Wireless
4.3.24. Miscellaneous
4.4. Networking
4.4.1. General
4.4.2. Protocols
4.4.3. Dial-up
4.4.4. DNS
4.4.5. Virtual Private Networks
4.4.6. Bridging
4.4.7. Routing
4.4.8. Security
4.4.9. Telephony / Satellite
4.4.10. Miscellaneous
4.5. Applications / GUI / Multimedia
4.5.1. Installing Applications
4.5.2. User Applications
4.5.3. Server Applications
4.5.3.1. DBMS / Databases
4.5.3.2. Mail
4.5.3.3. Usenet Network News
4.5.3.4. HTTP / FTP
4.5.3.5. Miscellaneous
4.5.4. GUI / Window Managers
4.5.4.1. X Window System
4.5.4.2. Window Managers
4.5.4.3. Fonts
4.5.5. Multimedia
4.5.5.1. Audio
4.5.5.2. Video
4.6. Programming
4.6.1. General
4.6.2. Compilers
4.6.3. Languages
4.6.4. Libraries
4.6.5. Interfaces / API / Protocols
4.6.6. Security
4.6.7. Tools
4.6.8. Version Control
4.6.9. DBMS / Databases
4.6.10. Miscellaneous
4.7. Other (human) Languages
4.7.1. Language Support
4.7.2. Using Specific Languages
4.8. Miscellaneous
4.8.1. Authoring / Documentation
4.8.2. Linux Advocacy / Getting (and Staying) Involved
4.8.3. Hobbies and Special Interests
4.9. Archived Documents
4.9.1. Archived Documents
5. Single list of HOWTOs
6. Single list of mini-HOWTOs
7. Unmaintained HOWTOs
8. Writing and Submitting a HOWTO
9. Copyright Information


Next


What Are Linux HOWTOs?

Thursday, December 07, 2006

Mobile programming

Mobile programming

From Wikipedia, the free encyclopedia

Jump to: navigation, search

Programming for mobile phones is its own discipline. A J2ME programming project has more in common with a BREW project then it does with a Java server side project.

The differences lies in the limitations common to most mobile programming languages and mobile environments. Resources are constrained, including screen size, memory, CPU, storage, and input method.

The expectations of the end user of a mobile product are also very different from the average web browser, or brick and mortar customer.

There are also different performance expectations from the hardware, and the API's used by the handset. Users and developers are both prepared for a certain degree of faults, especially in prototype or hard to acquire models.

See also

Mobile Environments


 This wireless-related article is a stub. You can help Wikipedia by expanding it.

Java Platform, Standard Edition - J2SE

Java Platform, Standard Edition

From Wikipedia, the free encyclopedia

Java Platforms
Micro Edition (ME)
Standard Edition (SE)
Enterprise Edition (EE)

Java Platform, Standard Edition or Java SE (formerly known up to version 5.0 as Java 2 Platform, Standard Edition or J2SE), is a collection of Java programming language APIs useful to many Java platform programs. The Java Platform, Enterprise Edition includes all of the classes in the Java SE, plus a number which are more useful to programs running on servers than on workstations.

Starting with the J2SE 1.4 version (Merlin), the Java SE platform has been developed under the Java Community Process. JSR 59 was the umbrella specification for J2SE 1.4 and JSR 176 specified J2SE 5.0 (Tiger). As of 2006, Java SE 6 (Mustang) is being developed under JSR 270.

The following are descriptions of some of the primary Java SE packages. For a complete list of packages see the J2SE 5.0 API Javadocs.

Contents

1 General purpose packages

General purpose packages

java.lang

The Java package java.lang contains fundamental classes and interfaces closely tied to the language and runtime system. This includes the root classes that form the class hierarchy, types tied to the language definition, basic exceptions, math functions, threading, security functions, as well as some information on the underlying native system.

The main classes in java.lang are:

Classes in java.lang are automatically imported into every source file.

java.lang.ref

The java.lang.ref package provides more flexible types of references than are otherwise available, permitting limited interaction between the application and the Java Virtual Machine (JVM) garbage collector. It is an important package, central enough to the language for the language designers to give it a name that starts with "java.lang", but it is somewhat special-purpose and not used by a lot of developers. This package was added in J2SE 1.2.

Java has a more expressive system of reference than most other garbage-collected programming languages, which allows for special behavior for garbage collection. A normal reference in Java is known as a strong reference. The java.lang.ref package defines three other types of references—soft, weak, and phantom references. Each type of reference is designed for a specific use.

A SoftReference can be used to implement a cache. An object that is not reachable by a strong reference (that is, not strongly reachable), but is referenced by a soft reference is called softly reachable. A softly reachable object may be garbage collected at the discretion of the garbage collector. This generally means that softly reachable objects will only be garbage collected when free memory is low, but again, it is at the discretion of the garbage collector. Semantically, a soft reference means "keep this object unless the memory is needed."

A WeakReference is used to implement weak maps. An object that is not strongly or softly reachable, but is referenced by a weak reference is called weakly reachable. A weakly reachable object will be garbage collected during the next collection cycle. This behavior is used in the class java.util.WeakHashMap. A weak map allows the programmer to put key/value pairs in the map and not worry about the objects taking up memory when the key is no longer reachable anywhere else. Another possible application of weak references is the string intern pool. Semantically, a weak reference means "get rid of this object when nothing else references it."

A PhantomReference is used to reference objects that have been marked for garbage collection and have been finalized, but have not yet been reclaimed. An object that is not strongly, softly or weakly reachable, but is referenced by a phantom reference is called phantom reachable. This allows for more flexible cleanup than is possible with the finalization mechanism alone. Semantically, a phantom reference means "this object is no longer needed and has been finalized in preparation for being collected."

Each of these reference types extends the Reference class which provides the get() method to return a strong reference to the referent object (or null if the reference has been cleared or if the reference type is phantom), and the clear() method to clear the reference.

The java.lang.ref also defines the class ReferenceQueue, which can be used in each of the applications discussed above to keep track of objects that have changed reference type. When a Reference is created it is optionally registered with a reference queue. The application polls the reference queue to get references that have changed reachability state.

See "Reference Objects and Garbage Collection" for a more thorough description of using reference types and reference queues.

java.lang.reflect

Reflection is a constituent of the Java API which enables Java code to examine and "reflect" upon Java components at runtime and to use the reflected members. Classes in this package, along with java.lang.Class and java.lang.Package accommodate applications such as debuggers, interpreters, object inspectors, class browsers, and services such as object serialization and JavaBeans that need access to either the public members of a target object (based on its runtime class) or the members declared by a given class. This package was added in JDK 1.1.

Reflection is used to instantiate classes and invoke methods using their names, a concept that allows for dynamic programming. Classes, interfaces, methods, fields, and constructors can all be discovered and used at runtime. Reflection is supported by metadata that the JVM has about the program. There are two basic techniques involved in reflection:

  1. Discovery involves taking an object or class and discovering the members, superclasses, implemented interfaces, and then possibly using the discovered elements.
  2. Use by name involves starting with the symbolic name of an element and using the named element.

[edit] Discovery

Discovery typically starts with an object and calling the Object.getClass() method to get the object's Class. The Class object has several methods for discovering the contents of the class, for example:

  • getMethods() – returns an array of Method objects representing all the public methods of the class or interface
  • getConstructors() – returns an array of Constructor objects representing all the public constructors of the class
  • getFields() – returns an array of Field objects representing all the public fields of the class or interface
  • getClasses() – returns an array of Class objects representing all the public classes and interfaces that are members (e.g. inner classes) of the class or interface
  • getSuperclass() – return the Class object representing the superclass of the class or interface (null is returned for interfaces)
  • getInterfaces() – returns an array of Class objects representing all the interfaces that are implemented by the class or interface

Use by name

The Class object can be obtained either through discovery, by using the class literal (e.g. MyClass.class) or by using the name of the class (e.g. Class.forName("mypackage.MyClass")). With a Class object, member Method, Constructor, or Field objects can be obtained using the symbolic name of the member. For example:

  • getMethod("methodName", Class...) – returns the Method object representing the public method with the name "methodName" of the class or interface that accepts the parameters specified by the Class... parameters.
  • getConstructor(Class...) – returns the Constructor object representing the public constructor of the class that accepts the parameters specified by the Class... parameters.
  • getField("fieldName") – returns the Field object representing the public field with the name "fieldName" of the class or interface.

Method, Constructor, and Field objects can be used to dynamically access the represented member of the class. For example:

  • Field.get(Object) – returns an Object containing the value of the field from the instance of the object passed to get(). (If the Field object represents a static field then the Object parameter is ignored and may be null.)
  • Method.invoke(Object, Object...) – returns an Object containing the result of invoking the method for the instance of the first Object parameter passed to invoke(). The remaining Object... parameters are passed to the method. (If the Method object represents a static method then the first Object parameter is ignored and may be null.)
  • Constructor.newInstance(Object...) – returns the new Object instance from invoking the constructor. The Object... parameters are passed to the constructor. (Note that the parameterless constructor for a class can also be invoked by calling newInstance().)

Arrays and proxies

The java.lang.reflect package also provides an Array class that contains static methods for creating and manipulating array objects, and since J2SE 1.3, a Proxy class that supports dynamic creation of proxy classes that implement specified interfaces.

The implementation of a Proxy class is provided by a supplied object that implements the InvocationHandler interface. The InvocationHandler's []) invoke(Object, Method, Object[]) method is called for each method invoked on the proxy object—the first parameter is the proxy object, the second parameter is the Method object representing the method from the interface implemented by the proxy, and the third parameter is the array of parameters passed to the interface method. The invoke() method returns an Object result that contains the result returned to the code that called the proxy interface method.

java.io

The java.io package contains classes that support input and output. The classes in the package are primarily stream-oriented; however, a class for random access files is also provided. The central classes in the package are InputStream and OutputStream which are abstract base classes for reading from and writing to byte streams, respectively. The related classes Reader and Writer are abstract base classes for reading from and writing to character streams, respectively. The package also has a few miscellaneous classes to support interactions with the host file system.

Streams

The stream classes follow the decorator pattern by extending the base subclass to add features to the stream classes. Subclasses of the base stream classes are typically named for one of the following attributes:

  • the source/destination of the stream data
  • the type of data written to/read from the stream
  • additional processing or filtering performed on the stream data

The stream subclasses are named using the naming pattern XxxStreamType where Xxx is the name describing the feature and StreamType is one of InputStream, OutputStream, Reader, or Writer.

The following table shows the sources/destinations supported directly by the java.io package:

Source/Destination Name Stream types In/Out Classes
byte array (byte[]) ByteArray byte in, out ByteArrayInputStream, ByteArrayOutputStream
char array (char[]) CharArray char in, out CharArrayReader, CharArrayWriter
file File byte, char in, out FileInputStream, FileOutputStream, FileReader, FileWriter
string (StringBuffer) String char in, out StringReader, StringWriter
thread (Thread) Piped byte, char in, out PipedInputStream, PipedOutputStream, PipedReader, PipedWriter

Other standard library packages provide stream implementations for other destinations, such as the InputStream returned by the java.net.Socket.getInputStream() method or the Java EE javax.servlet.ServletOutputStream class.

Data type handling and processing or filtering of stream data is accomplished through stream filters. The filter classes all accept another compatible stream object as a parameter to the constructor and decorate the enclosed stream with addional features. Filters are created by extending one of the base filter classes FilterInputStream, FilterOutputStream, FilterReader, or FilterWriter.

The Reader and Writer classes are really just byte streams with additional processing performed on the data stream to convert the bytes to characters. They use the default character encoding for the platform, which as of J2SE 5.0 is represented by the Charset returned by the java.nio.charset.Charset.defaultCharset() static method. The InputStreamReader class converts an InputStream to a Reader and the OutputStreamWriter class converts an OutputStream to a Writer. Both these classes have constructors that allow the character encoding to use to be specified—if no encoding is specified then the default encoding for the platform is used.

The following table shows the other processes and filters supported directly by the java.io package. All of these classes extend the corresponding Filter class.

Operation Name Stream types In/Out Classes
buffering Buffered byte, char in, out BufferedInputStream, BufferedOutputStream, BufferedReader, BufferedWriter
"push back" last value read Pushback byte, char in PushbackInputStream, PushbackReader
read/write primitive types Data byte in, out DataInputStream, DataOutputStream
object serialization (read/write objects) Object byte in, out ObjectInputStream, ObjectOutputStream

Random access

The RandomAccessFile class supports random access reading and writing of files. The class uses a file pointer that represents a byte-offset within the file for the next read or write operation. The file pointer is moved implicitly by reading or writing and explicitly by calling the seek(long) or skipBytes(int) methods. The current position of the file pointer is returned by the getFilePointer() method.

File system

The File class represents a file or directory path in a file system. File objects support the creation, deletion and renaming of files and directories and the manipulation of file attributes such as read-only and last modified timestamp. File objects that represent directories can be used to get a list of all of the contained files and directories.

The FileDescriptor class is a file descriptor that represents a source or sink (destination) of bytes. Typically this is a file, but can also be a console or network socket. FileDescriptor objects are used to create File streams. They are obtained from File streams and java.net sockets and datagram sockets.

java.nio

In J2SE 1.4, the package java.nio (NIO or New I/O) was added to support memory-mapped I/O, facilitating IO operations closer to the underlying hardware with sometimes dramatically better performance. The java.nio package provides support for a number of buffer types. The subpackage java.nio.charset provides support for different character encodings for character data. The subpackage java.nio.channels provides support for channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets. The java.nio.channels package also provides support for fine-grained locking of files.

java.math

The java.math package supports multiprecision arithmetic (including modular arithmetic operations) and provides multiprecision prime number generators used for cryptographic key generation. The main classes of the package are:

  • BigDecimal – provides arbitrary-precision signed decimal numbers. BigDecimal gives the user control over rounding behavior through RoundingMode.
  • BigInteger – provides arbitrary-precision integers. Operations on BigInteger do not overflow or lose precision. In addition to standard arithmetic operations, it provides modular arithmetic, GCD calculation, primality testing, prime number generation, bit manipulation, and other miscellaneous operations.
  • MathContext – encapsulate the context settings which describe certain rules for numerical operators.
  • RoundingMode – an enumeration that provides eight rounding behaviors.

java.net

The java.net package provides special IO routines for networks, allowing HTTP requests, as well as other common transactions.

java.text

The java.text package implements parsing routines for strings and supports various human-readable languages and locale-specific parsing.

java.util

Data structures that aggregate objects are the focus of the java.util package. Included in the package is the Collections API, an organized data structure hierarchy influenced heavily by the design patterns considerations.

Special purpose packages

java.applet

Created to support Java applet creation, the java.applet package allows applications to be downloaded over a network and run within a guarded sandbox. Security restrictions are easily imposed on the sandbox. A developer, for example, may apply a digital signature to an applet, thereby labeling it as safe. Doing so allows the user to grant the applet permission to perform restricted operations (such as accessing the local hard drive), and removes some or all of the sandbox restrictions. Digital certificates are issued by such agencies as Thawte or Entrust.

java.beans

Included in the java.beans package are various classes for developing and manipulating beans, reusable components defined by the JavaBeans architecture. The architecture provides mechanisms for manipulating properties of components and firing events when those properties change.

Most of the APIs in java.beans are intended for use by a bean editing tool, in which beans can be combined, customized and manipulated. One type of bean editor is a GUI designer in an integrated development environment.

java.awt

The Abstract Windowing Toolkit contains routines to support basic GUI operations and uses basic windows from the underlying native system. Many independent implementations of the Java API (such as GNU's libgcj) implement everything but AWT, which is not used by most server-side applications. This package also contains the Java2D graphics API.

java.rmi

The java.rmi package provides Java remote method invocation to support remote procedure calls between two java applications running in different JVMs.

java.security

Support for security, including the message digest algorithm, is included in the java.security package.

java.sql

An implementation of the JDBC API (used to access SQL databases) is grouped into the java.sql package.

javax.rmi

Provides the support for the remote communication between applications, using the RMI over IIOP protocol. This protocol combines RMI and CORBA features.

org.omg.CORBA

Provides the support for the remote communication between applications using general inter ORB protocol and supports other features of the common object request broker architecture. Same as RMI and RMI-IIOP, this package is for calling remote methods of objects on other virtual machines (usually via network). From all communication possibilities CORBA is the most portable between various languages. However it is also rather difficult to understand.

javax.swing

Swing is a collection of routines that build on java.awt to provide a platform independent widget toolkit. Swing uses the 2D drawing routines to render the user interface components instead of relying on the underlying native operating system GUI support.

Swing is a very rich system in its own right, supporting pluggable looks and feels (PLAFs) so that widgets in the GUI can imitate those from the underlying native system. Design patterns permeate the system, especially a modification of the model-view-controller pattern, which loosens the coupling between function and appearance. One inconsistency is that (as of J2SE 1.3) fonts are drawn by the underlying native system, and not by Java, limiting text portability. Workarounds, such as using bitmap fonts, do exist. In general, layouts are used and keep elements within an aesthetically consistent GUI across platforms.

javax.swing.text.html.parser

Provides the error tolerant HTML parser that is used for writing various web browsers and web bots.