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:

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!

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.

JDK 7u51 and JavaFX 2.2.51 Documentation Updates

The Java Development Kit 7 Update 51 (JDK 7u51) release with JavaFX 2.2.51 is available and can be downloaded from the Java SE Downloads page. For information about this release, see the JDK 7u51 Release Notes.

Documentation has been updated for the following changes to the JDK:

  • The 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. RIAs that are hosted on a site in the exception site list are allowed to run with the applicable security prompts.

  • Unsigned and self-signed RIAs are blocked when the security level is set to Very High or High. Also, the Permissions attribute that was added for 7u25 is now required when the Security Level slider in the Java Control Panel is set to either Very High or High. See the Security section of the Java Control Panel documentation for information on the criteria for allowing or blocking a RIA.

  • When signing a JAR file, time stamping the signature is recommended. A warning is shown if the signature is not time stamped. See Signing JAR Files for information.

  • When installing the JRE on Windows, or when the JRE is automatically updated on Mac OS X, users are prompted to restore the security prompts that they previously chose to hide by selecting the "Do not show this again" option.

Minor improvements have been made to some of the JavaFX tutorials, and the JavaFX API documentation has been updated for the 2.2.51 release.

For all tutorials, guides, and API documentation, see Java SE Technical Documentation and JavaFX 2 Documentation.

Tuesday Oct 15, 2013

JDK 7u45 and JavaFX 2.2.45 Documentation Updates

The Java Development Kit 7 Update 45 (JDK 7u45) release with JavaFX 2.2.45 is available and can be downloaded from the Java SE Downloads page. For information about this release, see the JDK 7u45 Release Notes.

The Java Control Panel now has an option for restoring the security prompts that were hidden when the option to not show the prompt again was selected. See the documentation for the Security tab for more information on the Restore Security Prompts option.

New JAR file manifest attributes are available to provide additional security for your applets and Java Web Start applications. See JAR File Manifest Attributes for Security for information on the Application-Name, Application-Library-Allowable-Codebase, and Caller-Allowable-Codebase attributes. The launchable examples in the Java Tutorial have been updated to use these new attributes, where applicable.

Note: The Permissions attribute that was added for 7u25 is now required when the Security Level slider in the Java Control Panel is set to Very High.

In the Java Tutorial, the JAXP trail has a new lesson on Processing Limits.

Minor improvements have been made to some of the JavaFX tutorials, and the JavaFX API documentation has been updated for the 2.2.45 release.

For all tutorials, guides, and API documentation, see Java SE Technical Documentation and JavaFX 2 Documentation.

Java Tutorials JDK 8 EA: Collections Trail

The Collections trail in the Java Tutorial has been updated to describe the preferred method of traversing collections with JDK 8, which is obtaining a stream and invoking its aggregate operations. Aggregate operations are often used with lambda expressions to make programming more expressive using fewer lines of code. The Collection, Set, List, and Map interface pages now contain examples that demonstrate this new language feature.

Thursday Oct 03, 2013

Signing a JNLP File

There are several advantages to signing a JNLP file. It will:

  • Ensure that others cannot change the content in your JNLP file. For example, by adding a random library, or changing application information.
  • Allow the use of arbitrary Java Virtual Machine (JVM) options and Java system properties in your application.
  • Prevent others from referencing your JAR file directly in their HTML browser applets.

To create a signed JNLP file you don't sign the JNLP file itself, but you include the JNLP file inside the directory structure before the JAR file is created and then signed. The JNLP file must be named APPLICATION.JNLP and is included in the JNLP-INF subdirectory. The JAR file is then created and signed in the usual manner. When a web start application is started, the JNLP file used must be identical to the JNLP file in the signed JAR in order for the application to run.

Note that you cannot use the APPLET tag to run an applet if JAR file contains a signed JNLP file.

The Signing and Verifying JAR Files lesson in the Java Tutorial explains how to sign a JAR file.

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