Tuesday Apr 15, 2014

Java EE 7 Tutorial Updated!

The latest update to the Java EE 7 Tutorial is now public. Update 7.0.4 includes many bug fixes, both in the examples and in the documentation. Although most of these fixes were small, taken together they significantly improve the quality of the tutorial.

Kin-man Chung conducted a thorough review and provided several corrections and good suggestions that we incorporated to greatly improve Chapter 9, Expression Language.

Additional instructions for using the user and administrative interfaces in Duke's Tutoring case study were added.

We went through all of the examples and cleaned up the code to minimize warnings that you could see when you ran the examples or used the IDE's code editor to examine the files that made up the examples.

We verified that all of the examples work properly with the latest versions of JDK 7, JDK 8, and NetBeans IDE 8.0.

We incorporated the copy edits that came back from our publisher, so what you see online will match what you see in the two-volume printed set that will be available from your favorite booksellers next month.

Follow the instructions in Section 2.1, Required Software to obtain and install the update.

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 Nashorn – New JavaScript Engine for Java SE 8

JDK 8 introduces Nashorn: a new JavaScript engine written in Java, which implements the Java Scripting API based on JSR-223: Scripting for the Java Platform. Nashorn takes full advantage of the latest technologies for native JVMs described in JSR-292: Supporting Dynamically Typed Languages on the JavaTM Platform.

For more information about Nashorn and other scripting features implemented on the Java Platform, see Scripting for the Java Platform.

Jim Laskey has presented a screencast titled JavaScript on the JVM during the Java 8 Launch Webcast where Nashorn was discussed in more detail.

Learn More About Monitoring and Management Improvements in JDK 8

For users of commercial packages Java SE Advanced and Java SE Suite, JDK 8 includes a new version of Java Mission Control (JMC) that introduces a number of improvements to monitoring and profiling the HotSpot VM. JMC is a powerful set of tools for managing a running application and JVM. You can use it to perform extensive analysis based on detailed monitoring and profiling data.

JMC 5.3.0 reintroduces the Diagnostic Commands tab. This tab can be used to remotely execute commands available via the jcmd utility.

Another big improvement is the addition of content types for attributes. This means that each attribute contains metadata about its physical quantity and units, which helps rendering the attribute values on graphs properly with little or no configuration.

In addition, a number of known issues have been fixed, increasing overall stability and performance

To learn more about JMC 5.3.0, see the JMC User's Guide.

Marcus Hirt has presented a screencast titled Introducing Java Mission Control 5.3.0 during the Java 8 Launch Webcast where new JMC features were discussed in more detail.

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:

myShapesCollection.stream()
.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:

myShapesCollection.parallelStream()
.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

Learn More About Enhancements in JavaFX 8

The JavaFX documents were updated for release 8. To symbolize JavaFX integration into Java SE, the JavaFX 8 documentation index has moved to a new URL at http://docs.oracle.com/javase/8/javase-clienttechnologies.htm. The old URL at http://docs.oracle.com/javafx will send you to this new page. You can still access the JavaFX 2 documentation at http://docs.oracle.com/javafx/2/.

The JavaFX writers have always provided many sample applications to go with their tutorials. These samples contain source code, resources, and NetBeans IDE project files, and the accompanying tutorial explains the code. Now you can view a list of the samples on a single index page, see which tutorial they belong to, and download any that you like. Moreover, JavaFX applications are shown in tutorials using a new visual theme.

Get familiar with JavaFX 8 enhancements to WebView’s HTML5 support in the Adding HTML Content to JavaFX Applications tutorial, review Getting Started with JavaFX 3D Graphics, and learn how to embed Swing content in JavaFX applications.

The JavaFX UI Components tutorial comes with the following new chapters:

  • Tree Table View - introduces the TreeTableView user interface component, a control designed to visualize an unlimited number of rows of data broken out into columns.
  • Date Picker - discusses how the DatePicker control can be used in JavaFX applications to enable selection of a day from the given calendar.
  • JavaFX UI Controls on the Embedded Platforms - describes the specifics of using JavaFX UI controls in the embedded environments.

The Handling Events tutorial provides a new chapter to illustrate the Drag-and-Drop feature using the PaperDoll application.

See the JDK 8 Release Notes for detailed information about this release.

Jim Weaver has presented a screencast titled What's New for JavaFX in Java SE 8 during the Java 8 Launch Webcast.

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!

Friday Feb 14, 2014

Java ME Embedded 8 Early Access 2

The long awaited second early access release of Oracle Java ME Embedded 8 is available on OTN.

It comes with the following updates and enhancements to the Oracle Java ME Embedded software:

  • Enhanced device controls and improved input/output (IO) for small embedded devices, including a windowed Watchdog timer.
  • Ongoing support for CLDC 8 and Profile MEEP 8
  • Device Access APIs
  • Generic Connection Framework (GCF) API

See the following Reference Platform Release Notes for more information about the new features and platform-specific aspects:

Release Notes for Raspberry Pi

Release Notes for Qualcomm IoE

See the Oracle Java ME Software Development Kit Release Notes to learn how these features can be used to develop Java ME applications with Java ME SDK.

The Java ME documentation team published the Getting Started Guides for all the supported platforms. Ready to try the new features? Check the following documents:

Java ME Embedded and SDK documentation and related API specifications can be found at docs.oracle.com/javame.

Tuesday Jan 14, 2014

Java Tutorial JDK8 Early Access Updates

An updated Java Tutorial was released today to coincide with the release of JDK 7u51. In addition to the changes for the 7u51 release, this update includes the following changes to JDK 8 early access documentation:

  • The Type Inference section in the Generics trail has been updated with the section Target Types, which describes how the Java compiler takes advantage of target typing to infer the type parameters of a generic method invocation in JDK 8.

  • The names of the formal parameters of any method or constructor in JDK 8 can be obtained with the method java.lang.reflect.Executable.getParameters. See the section Obtaining Names of Method Parameters.

  • The Interfaces and Inheritance trail has been enhanced with information about Default Methods in JDK 8, which are methods in an interface that have an implementation. In addition, you can define static methods in interfaces.

  • The Collections trail has been updated with new Questions and Exercises for Interfaces and Aggregate Operations in JDK 8. These updates help you focus on some important points when working with lambda expressions, streams, and aggregate operations.

For more information on JDK 8 Early Access documentation, see JDK 8 Documentation - Developer Preview Release.

About

Blog about Java technology documentation and news about Java releases.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today