Sun Java Solaris Communities My SDN Account Join SDN
 
Reference

Code Samples and Apps

Early Access
Tools
 
API Specifications
Documentation
Code Samples & Apps
BluePrints
Technical Articles & Tips
FAQs
White Papers
Case Studies
Glossary
Presentations & Audiocasts
 
Forums
Bug Database
Chats
User Groups
Newsletters
Books & Authors
 
 
New to Java Center
Tutorials
Training
Certification
Quizzes
 
 

This is a master index of Java programming language code samples organized by topic. Your browser's built-in search function in the Edit menu can also help you locate topics.

Cross-Platform Technologies

  • Internationalization: Designing an application so it can be adapted to various languages and regions without engineering changes. Localization is the process of adapting software for a specific region or language by adding locale-specific components and translating text.

  • Java BluePrints: Illustrating design patterns and best practices for Java platform-based end-to-end (client-server) solutions.

  • Performance Tuning: Learning strategies and tactics for optimizing the performance of programs written in the Java programming language.

  • Security: Signing and verifying signed data, encrypting and decrypting data, and writing a security manager. A security manager is a Java virtual machine (JVM1) object that implements a security policy such as prompting an end user for password verification.

  • NetBeans Sample Catalog: Browse the NetBeans Sample Catalog for a comprehensive collection of sample applications spanning the latest enterprise, web, mobile, and scripting technologies.

Jini Network Technology

Java EE

Get Java EE code samples and applications here.

Application Clients

  • Desktop applications: Writing client programs that run on a Java platform-enabled client machine. A desktop application might connect to a server-side technology such as a Java EE server.

Business Processing

Client Communications

  • JavaServer Pages Technology: Creating Web content that has both static and dynamic components.

  • Servlets: Extending a server program to enhance its functionality. One very common use for servlets is to extend a Web server by providing dynamic Web content.

Message Communications

Network Communications

  • JDBC Technology: Invoking SQL commands to create database tables, access the data stored in a table, and create and manage distributed transaction. The J2SE 1.4 and all versions of Java EE provide these APIs. Prior to J2SE 1.4, you have to download the javax.sql package for distributed transactions separately.

  • Java EE Connector Architecture: Enabling Java EE components such as enterprise beans to connect to and interact with Enterprise Information Systems (EISs).

  • Resource Connections: Setting Enterprise beans and Web components up to access resources such as databases, a mail session, Java Message Service objects, and URLs.

  • Transactions: Rolling back a transaction in the event of an error and maintaining database integrity.

Java ME

  • Java ME Tech Tips
  • Small devices: Writing client programs that run on small wireless devices such as cell phones, personal digital assistants, and smart cards, and larger wired or wireless devices such as Internet-enabled smart phones.

Java SE

These code samples show how to use core APIs from Java SE, which aggregates APIs that can apply to both distributed and non-distributed applets and applications. For additional code samples that apply to Java SE, see also:

Advanced Topics

  • Reference Objects: Maintaining special references to objects that allow the program to interact with the garbage collector in limited ways.

  • Reflection: Representing or reflecting the classes, interfaces, and objects in the JVM.

  • Threaded Programs: Timing, setting thread priority, and synchronizing threads.

Applets

  • Applets: Writing small client programs that run in a Java platform-enabled browser. The small program is embedded in a web page, and might connect to a server-side technology such as a Java EE server. Running applets securely using Java Web Start is also covered.

Classes, Objects, & Inheritance

Deployment

Essential APIs

  • Characters & Strings: Performing character and string operations.

  • Collections: Grouping multiple elements into a single unit (collection). Collections let you store, retrieve, and manipulate data, and transmit data from one method to another.

  • Error Handling: Using exceptions for error handling in the Java programming language.

  • JavaBeans Technology: Using APIs and tools that let you create reusable, platform-independent software components that you can combine into applets, applications, or composite components.

  • Language Basics: Using variables, arrays, operators, flow of control, and scope.

  • Numbers and Math Operations: Using floats, doubles, arithmetic operations, converting numbers to strings, trigonometry, and more.

  • Reading and Writing Data: Reading data from and write data to external storage. Includes serialization and custom protocol handling.

Graphical User Interfaces (GUIs)

  • Graphical User Interfaces with JFC Swing: Building GUIs with the Swing package, which is part of the Java Foundation Classes (JFC). Includes code samples for the Accessibility API.

  • Multi-Media: Enhancing a user interface with 2D graphics, 3D graphics, printing, imaging, and sound.

Network Communications

  • CORBA/IDL: Letting distributed objects interact regardless of whether they are written in the Java programming language or another language.

  • Remote Method Invocation (RMI): Establishing remote communications between programs written in the Java programming language. RMI enables an object running in one JVM to invoke methods on an object running in another JVM.

Open Source

These code samples are from various open source repositories.

XML/Web Services

  • Java API for XML processing (JAXP): Accessing XML documents either serially (SAX) or in random access mode (DOM).

  • Web Services: Creating web-based services that are accessed by business application programs. The service receives the request for its services and returns a response.
1 As used on this web site, the terms Java virtual machine or JVM mean a virtual machine for the Java platform.
Related Links