Wednesday Oct 28, 2015

JavaOne 2015: Understanding Java Garbage Collection [CON6936]

On Wednesday, October 28th, Gil Tene (CTO, Azul Systems) explains why garbage collection is an integral part of application behavior on Java platforms, but is often misunderstood. This session [CON6936] reviews and classifies various garbage collection techniques available in JVMs today. After a quick overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors.

For more information, see:

Wednesday Oct 08, 2014

Java SE Documentation Survey 2014

The Java SE documentation team is conducting a brief survey at the following URL:

Answering it will provide us with key insights into the kinds of developer documentation that you (our readers) are looking for. Thank you in advance. We value your input very much!

Tuesday Mar 25, 2014

Learn More About Compact Profiles

Compact Profiles contain predefined subsets of the Java SE platform and enable applications that do not require the entire platform to be deployed and run on small devices. Developers can choose the appropriate profile based on the resources of the target hardware. The following profiles are available in Java SE 8:

  • compact1: Smallest set of API packages without omitting classes. Logging and SSL are included. See Profile compact1 for a list of the packages, classes, and interfaces that are included.

  • compact2: Includes everything in compact1 plus XML, JDBC and RMI. See Profile compact2 for a list of the packages, classes, and interfaces that are included.

  • compact3: Includes everything in compact2 plus management, naming, more security, and the compiler API. See Profile compact3 for a list of the packages, classes, and interfaces that are included.

For more information about compact profiles, see the following resources:

See What's New in JDK 8 for information about other new features in JDK 8.

Learn More About Java Type Annotations

Java SE 8 brings a variety of improvements to the "metadata" features of the Java language and libraries. Annotations are more flexible and useful than ever. Annotations can now be applied anywhere a type is used, which enables stronger type checking of your code, and the same annotation type can be applied more than once to the same declaration or type use. It is also now possible to reflect over the names of method parameters.

For more information about annotations and reflection, see the following resources:

See What's New in JDK 8 for information about other new features in JDK 8.

Learn More About the Date-Time API

JDK 8 includes a new Date-Time API based on JSR 310. This API provides a comprehensive date-time model that enables you to represent dates and times and manipulate date and time values. It supports the International Organization for Standardization (ISO) calendar system as well as other commonly used global calendars. Classes in the java.time package replace the Date, Calendar, TimeZone, and DateFormat classes in the java.util package.

For information about the Date-Time API, see the following resources:

  • The Date-Time Trail of the Java Tutorial covers the classes based on the standard ISO calendar system, and includes information about migrating from the java.util date classes to the new java.time API.

  • The API documentation for the Date-Time API describes the classes and methods that are available.

  • The screencast A New Date and Time API - JSR 310 by Stephen Colebourne provides an overview of the API, explaining the core concepts and classes, and enables you to dive straight in when it is time to code.

  • Java 8 Launch has screencasts that describe the feature.

See What's New in JDK 8 for information about other new features in JDK 8.

Learn More About Lambda Expressions

Java SE 8 introduced Lambda Expressions, a powerful new behavior abstraction feature that enables code to be passed around as data. Lambda expressions make your code easier to read, easier to maintain, and less prone to error. Lambda expressions make it possible to express a problem with a higher level of abstraction than was previously possible. Use Lambda Expressions to eliminate large chunks of "boilerplate" code (such as when using inner classes to express behavior), and accomplish more work in less lines of code.

For more information about Lambda Expressions, see the following resources:

See What's New in JDK 8 for information about other new features in JDK 8.

Learn More About Performance Improvements in JDK 8

Each release of the JDK includes enhancements that improves the performance of the Java platform. The following describes some of these enhancements in JDK 8:

  • The concurrent libraries have undergone a major revision to improve scalability. See Concurrency Utilities Enhancements in Java SE 8.
  • Tiered Compilation, which was introduced in JDK 7, has been enabled by default and brings server VM startup speeds close to or on par with the client VM. For details on how to control the compiler, see the documentation for the java command.
  • Permament generation, where the VM stored internal native data structures, such as class information, has been replaced with metaspace. Metaspace eliminates java.lang.OutOfMemoryError: PermGen space errors. The java command introduces the option -XX:MetaspaceSize, which sets the maximum amount of native memory that can be allocated for class metadata. By default, the size is not limited. In addition, the experimental option -Xshare has been introduced, which reduces footprint and startup time by sharing loaded JDK classes between all Java processes on the same host.
  • The Nashorn JavaScript engine dramatically improves upon the performance of the JDK 7 JavaScript engine.
  • The new language feature Lambda expressions performs better than inner classes.
  • The performance of JavaFX has been improved in JDK 8.

See the Java 8 Launch Webcast and What's New in JDK 8 for additional information of other new features in JDK 8.

Download JDK 8 today and try it out!

Learn More About Security Enhancements in Java SE 8

Oracle constantly works on improving the security of the Java platform. The following security enhancements are new for JDK 8; see JDK 8 Security Enhancements for more details:

  • Client-side TLS 1.2 (an industry standard) enabled by default; improves security of data in transit; see the Protocols section of the SunJSSE Provider and Customizing JSSE
  • Enhanced support for certification revocation checking; it enables the Java community to better police their own certificates; see Check Revocation Status of Certificates with PKIXRevocationChecker Class
  • New tool, jdeps, Java class dependency analyzer, identifies external dependencies that may negatively impacting your applications' ability to upgrade to the latest security patches
  • Type Annotations help ensure that your data is consistent with your requirements
  • SSL/TLS Server Name Indication (SNI) Extension is a TLS extension to support virtual hosting environments; previously, HTTPS servers could not be hosted in a virtual hosting infrastructure where multiple domains share the same IP address; see Server Name Indication (SNI) Extension
  • High entropy random number generation; see SecureRandom section of the JCA Reference Guide and the SecureRandom API Specification
  • The cryptographic algorithms in JDK 8 have been enhanced with the SHA-224 variant of the SHA-2 family of message-digest implementations
  • Support for NSA Suite B cryptography has been enhanced
  • The PKCS 11 provider support for Windows has been expanded to include 64-bit
  • Overhauled JKS-JCEKS-PKCS12 Keystore

Many recent improvements focus on limiting attackers from using malicious applets and Rich Internet Applications (RIAs), which have been added in JDK 7 update releases and critical patch updates (CPUs) and in JDK 8. These improvements are described in Java Rich Internet Applications Enhancements in JDK 7, which include the following:

  • Ability to set the security level of the Java client in the Java Control panel
  • Ability to disable any Java application from running in the browser
  • JREs have an expiration date; JREs will behave differently after their expiration date, which encourages upgrades; see JDK 7u10 Release Notes
  • Expanded blacklisting support, which includes a certificate and jar blacklist repository maintained by Oracle; see JDK 7u21 Release Notes
  • Recommendation that all applications be privileged (previously called "signed" applications); otherwise, applications are restricted to the security sandbox
  • By default, all certificates are checked using both OCSP and CRLs
  • New JAR file manifest attributes to defend RIAs against unauthorized code repurposing
  • Deployment Rule Set feature enables an enterprise to establish a whitelist of known applications; applications on the whitelist can be run without most security prompts
  • Ability for enterprises who manage their update process to disable checking of JREs if they are expired or below the security baseline
  • Exception Site List feature provides a way for users to run Java applets and Java Web Start applications that do not meet the latest security requirements

Milton Smith has presented the screencast Java 8 Security Highlights during the Java 8 Launch Webcast, which discusses these enhancements.

See What's New in JDK 8 for additional information of other new features in JDK 8.

Download JDK 8 today and try it out!

Learn More About New Features in Java SE 8

Java SE 8 introduces significant enhancements to the Java language and class libraries. These enhancements enable you to make code more concise without losing readability; write more reliable code; better utilize multi-core and multi-processor systems (code is no longer inherently serial or parallel); and detect more errors at compile time, rather than at run time.

See What's New in JDK 8 and JDK 8 Adoption Guide for more detailed information on these new features and how to adopt them.

Learn more about these features with the following links from Java SE 8 Technical Documentation:

  • Java Language Enhancements
    • Lambda Expressions enable you to treat functionality as a method argument, or code as data. They are similar to closures and provide more concise anonymous function types and a more functional style of programming.
    • Default Methods (or Extension Methods) provide a mechanism to add new methods to existing interfaces.
    • Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration.
    • Improved Type Inference enables the Java compiler to takes advantage of target typing to infer the type parameters of a generic method invocation. The target type of an expression is the data type that the Java compiler expects depending on where the expression appears.
    • Obtaining Names of Method Parameters shows you how to retrieve parameter names of methods and constructors (not just types and return types) by reflection.
  • Core Libraries Enhancements
  • Java Virtual Machine Enhancements
    • Nashorn is a lightweight, high-performance JavaScript engine, which is integrated into the JRE.
    • java command lists deprecated and removed options as a result of the retirement of rarely used garbage collection combinations and the removal of permanent generation

Simon Ritter has presented the screencast New Features in Java SE 8: A Developer's Guide during the Java 8 Launch Webcast, which discusses these features.

Download JDK 8 today and try it out!

Monday Mar 24, 2014

Learn More About Streams and Collections

Lambda Expressions are a major new language feature introduced in Java SE 8. Related to that change are the Streams API and Aggregate Operations on Collections. The Collection interface now exposes methods Stream<E> stream() and Stream<E> parallelStream(), for obtaining sequential or parallel streams from an underlying collection.

Here's a quick example showing how this new API (with Lambda Expressions) would be used in place of a traditional Iterator or for loop. It obtains a stream from the underlying collection, selects only red objects, then prints out the name of each object that was matched:
.filter(e -> e.getColor() == Color.RED)
.forEach(e -> System.out.println(e.getName()));

Likewise, you could easily request a parallel stream, which might make sense if the collection is large enough and your computer has enough cores:

.filter(e -> e.getColor() == Color.RED)
.forEach(e -> System.out.println(e.getName()));

Using streams enables your code focus on "what" to do (instead of "how" to do it), leaving the library free to use whatever techniques it deems most appropriate (laziness, out-of-order execution, parallelism, etc.).

For more information on Lambda Expressions and Aggregate Operations, see the following resources:

See What's New in JDK 8 for information about other new features in JDK 8.

Tuesday Mar 18, 2014

JDK 8 Is Released!

Java SE 8 has gone live! Download it from the Java SE Downloads page.

For this release, the Java SE 8 landing page has been revamped and the Java Tutorials have been updated.

See the JDK 8 Release Notes for detailed information about this release. Highlights include the following:

Download JDK 8 today and try it out!


Blog about Java technology documentation and news about Java releases.


« August 2016