X

Recent Posts

Java

Java on Container Like A Pro

JVM in containers Modern day software systems are moving towards containers, and there are few important factors to understand, before we move our Java / JVM based applications on containers and these factors are raising questions if Java is really good for containers? so lets see how java is making progress and what is there for containers. Suppose, Our environment has deployed 10 instances of an application into a container and all the sudden the application starts throttling and not achieving the same performance as we have seen on our development environment. What exactly has happened? In order to allow multiple containers to run isolated side-by-side, we have specified it to be limited to one cpu (or the equivalent ratio in CPU shares). Unfortunately, the JVM will see the overall number of cores on that node (64) and use that value to initialize the number of default threads we have seen earlier. As started 10 instances, we end up with: 10 * 64 Jit Compiler Threads 10 * 64 Garbage Collection threads 10 * 64 …. And so on… Moreover, our application, being limited in the number of CPU cycles it can use, is mostly dealing with switching between different threads and does cannot get any actual work done. All the sudden the promise of containers, “Package once, run anywhere’ seem violated. Before JDK 8.0_131, it gets the core count resources from sysconf. That means that whenever we run it in a container, we are going to get the total number of processor available on the system, or in case of virtual machines: virtual system. The same is true for default memory limits: the JVM will look at the host overall memory and use that for setting its defaults. We can say that the JVM ignoring cgroups and that cause problems as we have seen above. Unfortunately, there is no CPU or memory namespace (also, namespaces usually have a slightly different goal), so a simple less /proc/meminfo from inside the container will still show us the overall memory on the host. We can say that the JVM ignoring cgroups and that cause problems as we have seen above. Java 8.0_131 onwards on containers! Java now supports Docker CPU and memory limits. Let us look at what “support” actually means. Please look into the below Jira which shows the list of improvement in java for Containers. https://bugs.openjdk.java.net/browse/JDK-8146115: Improve Docker container detection and resource configuration usage https://bugs.openjdk.java.net/browse/JDK-8196595 These changes are available in 8u192. [It is expect to release in Oct 2018]   The JVM can recognize the memory and CPU configurations of the container it is running in. For instance, if the Docker container has configured to run with 1024m of memory, the JVM can now detect that, and can in turn configure its java heap and the sizes of its other memory pools accordingly. Therefore, to have a smaller footprint of your Docker instance, all you have to do is to control the size of that container instance. The same applies for the CPU configuration as well. You focus on configuring the number of CPUs that you would like the container instance to use, and the JVM running inside it will be able to detect that configuration, and limit its CPU use to that configuration. Memory The JVM will now consider cgroups memory limits if the following flags are specified:      -XX:+UseCGroupMemoryLimitForHeap      -XX:+UnlockExperimentalVMOptions      In that case, the Max Heap space will be automatically (if not overwritten) be set to the limit specified by the cgroup. As we discussed earlier, the JVM is using memory besides the Heap, so this will not      prevent user from the OOM killer removing their containers. However, especially giving that the garbage collector will become more aggressive as the Heap fills up, this is already a great improvement. CPU      The JVM will automatically detect cpusets and if set use the number of CPUs specified for initializing the default values discussed earlier. Unfortunately, most users (and especially container orchestrators such as DC/OS) use CPU shares as the default CPU isolation. Moreover, with CPU shares you will still end up with the incorrect value for      default parameters. So what can we do?      We should consider manually overwriting the default parameter     (e.g., at least XMX for memory and XX:ParallelGCThreads, XX:ConcGCThreads for CPU) according to your specific cgroup limits. Considering Non-Heap Memory in Java The JVM memory consists the following segments: Heap Memory Non-Heap Memory, which is used by Java to store loaded classes and other meta-data JVM code itself, JVM internal structures, loaded profiler agent code and data, etc. The JVM has memory other than the heap, referred to as non-heap memory. It has created at the JVM startup and stores per-class structures such as runtime constant pool, field and method data, and the code for methods and constructors, as well as interned Strings. In previous versions of Java (before 1.8), JVM specifies a default space of 64 MB for permgen space, and this could be modified according to need of requires more than 64 MB. In Java 8, PermGen has been renamed to Metaspace - with some subtle differences. It is important to note that Metaspace has an unlimited default maximum size (-XX:MaxMetaspaceSize=?MB). On the contrary, PermGen from Java 7 and earlier has a default maximum size of 64 MB on 32-bit JVM and 82 MB on the 64-bit version. Of course, these are not the same as the initial sizes. Java 7 and earlier starts with something around 12-21 MB of the initial PermGen space. However, MetaSize can be set but there was a bug in the java that specified metaspacesize was not committing.  Ref https://bugs.openjdk.java.net/browse/JDK-8067100 Now after setting heap and MetaSpaceSize, what options do we have? There is no way that we can limit the native memory usage of an application. After allocating java heap and Metaspace, whatever left in the system memory, a java application is free to use that for other native allocations. We can limit that by limiting the total memory available to the container itself, by configuring the total memory of the container. However, if our application is extensively using Direct memory buffers (native allocations), we can control the maximum size of those by using the JVM option MaxDirectMemorySize, and that in turn will control the size of native allocations. We can say that the JVM ignoring cgroups and that cause problems as we have seen above. Unfortunately, there is no CPU or memory namespace (also, namespaces usually have a slightly different goal), so a simple less /proc/meminfo from inside the container will still show us the overall memory on the host.

JVM in containers Modern day software systems are moving towards containers, and there are few important factors to understand, before we move our Java / JVM based applications on containers and these...

Java and the New Duke Personality

For 24+ years, Java technology has advanced the world we interact with every day.  With Oracle’s stewardship, Java technology continues to offer developers innovative functionality to build out the next generation of applications that bring utility to us, both personally and professionally. And during the history of Java, it’s been represented by the highly recognized Duke personality.  Back in the early days of Java development, Sun Microsystems’ Green Project team created its first working demo—an interactive handheld home entertainment controller called the Star7. At the heart of the animated touch-screen user interface was a cartoon character named Duke. The jumping, cartwheeling Duke was created by one of the team’s graphic artists, Joe Palrang. Joe went on to work on popular animated movies such as Shrek, Over the Hedge, and Flushed Away. Duke was designed to represent a “software agent” that performed tasks for the user. Duke was the interactive host that enabled a new type of user interface that went beyond the buttons, mice, and pop-up menus of the desktop computing world. Duke was instantly embraced. In fact, at about the same time Java was first introduced and the first Java cup logo was commissioned, Duke became the official mascot of Java technology. In 2006, Duke was officially “open sourced” under a BSD license. Developers and designers were encouraged to play around with Duke and for the first time had access to Duke’s graphical specifications through a java.net project. Efforts around Duke are now hosted as “Project Duke” at OpenJDK. At Oracle, we celebrate Duke, too. A living, life-size Duke was a popular feature at every JavaOne developer conference, and now at Oracle’s flagship developer event…Oracle Code One. This year, Oracle is releasing a new Duke personality that embodies the open and innovative spirit and how Java continues to propel itself into the future. Please help us welcome Cloud Surfer Duke!

For 24+ years, Java technology has advanced the world we interact with every day.  With Oracle’s stewardship, Java technology continues to offer developers innovative functionality to build out the...

Code One

Java is alive at Oracle Code One!

The second annual Oracle Code One conference will soon be here.  Again, it will showcase a wide and deep variety of developer technology initiatives Oracle is investing and participating in…from machine learning to artificial intelligence, autonomous database to microservices, and of course the Cloud. Yet, the primary conference focus continues to shine a bright spotlight on Java technology.  That’s because Java remains an important area for Oracle in terms of stewardship, technology innovation and ecosystem enablement. During the event, attendees will have a variety of immersive options to experience the ongoing Java advancements at Oracle and from the broader developer community.  From a content perspective, Oracle Code One offers 3 dedicated Java technology tracks with over 200 sessions for attendees to experience. The backbone of Java content continues to be offered in the Core Java Platform track.  This track showcases wide ranging Core Java topics such as ongoing language improvements and JVM enhancements.  If you’re attending Oracle Code One we’d like to offer you this cheat sheet of important, can’t miss Core Java sessions --- please be sure to pre-register since rooms fill up fast!  Please check the conference catalog for the most accurate scheduling information Monday, September 16 DEV4284 JDK Mission Control: Where We Are, Where We Are Going David, Buck (Oracle) 9:00am-9:45am - Moscone South - Room 301 DEV3873 Java Modules: Why and How? Venkat Subramaniam (Agile Developer, Inc) 12:30pm-1:15pm - Moscone South - Room 303 DEV6727 Monitoring and Troubleshooting Tools in JDK/bin Poonam Parhar (Oracle, Corp) 4:00pm-4:45pm - Moscone South - Room 207/208 DEV6727 Busting Myths about Java Support from Oracle Alexandra Huff (Oracle) Aurelio Garcia-Ribeyro (Oracle) Manish Gupta (Oracle) 4:00pm-5:00pm - Moscone South - Room 307 DEV3219 Does Java Need Value Types? What They Give Java from a Performance Perspective Sergey Kuksenko (Oracle) 4:00pm-4:45pm - Moscone South - Room 301 DEV3463 Vector API Vladimir Ivanov (Oracle) Kishor Kharbas (Intel) 4:00pm-4:45pm - Moscone South - Room 303 DEV4112 JavaFX 12 and Beyond Kevin Rushforth (Oracle) 5:00pm - 5:45pm - Moscone South - Room 202 DEV4312 Java Bytecode Crash Course David Buck (Oracle) 5:00pm - 5:45pm - Moscone South - Room 205 DEV6321 - Advances in Java Security Jim Manico (Manicode Security) 6:00pm-6:45pm - Moscone South Room 203 Tuesday, September 17 TUT3781 Java 5, 6, 7, 8, 9, 10, 11, 12, 13: What Have You Missed? Henri Tremblay (TradingScreen) 8:45am-10:45am - Moscone South - Room 214 TUT3090 Coding Your Way to Java 13 Sander Man (Picnic) 8:45am-10:45am - Moscone South Room 203 DEV5937 Java Language Futures: 2019 Edition Brian Goetz (Oracle) 11:30am-12:15pm - Moscone South - Room 203 DEV3884 CompleteFuture: The Promises of Java Venkat Subramaniam (Agile Developer, Inc) 12:30pm-1:15pm - Moscone South - Room 304 DEV6243 Transitioning the Java Ecosystem to Six-Month Continuous Updates: Oracle Needs Your Help Bernard Traversat (Oracle) 12:30pm-1:15pm - Moscone South - Room 301 DEV5024 OpenJDK Development Jesper Wilhelmsson (Oracle) 1:30pm-2:15pm - Moscone South - Room 304 DEV1262 Exceptions 2020 Mike Duigou (Boeing) 1:30pm-2:15pm - Moscone South - Room 308 DEV4150 Java Packaging Tool: Create Native Installers to Deploy Java Applications Kevin Rushforth (Oracle) Phil Race (Oracle) 5:00pm-5:45pm - Moscone South - Room 204 DEV4681 What’s New in the Java Language and Tooling Michel Trudeau (Oracle) 5:00pm-5:45pm - Moscone South - Room 301 DEV4356 Hangs, Slowdowns, Starvation - Oh My! A Deep Dive into the Life of a Java Thread David Buck (Oracle) 6:00pm-6:45pm - Moscone South - Room 304 Wednesday, September 18 DEV4253 invokedymanic for Mere Mortals David Buck (Oracle) 11:30am-12:15pm - Moscone South - Room 301 DEV3923 Local Variable Type Inference: Friend or Foe? Stuart Marks (Oracle) Simon Ritter (Azul Systems) 11:30am-12:15pm - Moscone South - Room 303 DEV3407 Condy? NestMates? Constable? Understanding JDK11 and JDK12 JVM Features Dan Heidinga (IBM) 11:30am-12:15pm - Moscone South - Room 205 DEV3891 Exploring Collectors Venkat Subramaniam (Agile Developer, Inc) 11:30am-12:15pm - Moscone South - Room 203 DEV4421 CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solutions David Buck (Oracle) 12:30pm-1:15pm - Moscone South - Room 303 BOF3989 Oracle JDK and Oracle OpenJDK: An Open Conversation Aurelio Garcia-Ribeyro (Oracle) Sharat Chander (Oracle) 12:30pm-1:15pm - Moscone South - Room 309 DEV3957 Java Flight Recorder: Black Box of Java Applications Poonam Parhar (Oracle) 12:30pm-1:15pm - Moscone South - Room 203 DEV4996 The Lean, Mean…OpenJDK? Claes Redestad (Oracle) 1:30pm-2:15pm - Moscone South - Room 304 DEV4004 Maximize Java Cloud Stack Performance and Efficiency with These Tricks Bob Vandette (Oracle) 5:00pm-5:45pm - Moscone South - Room 304 DEV3877 Functional Programming Idioms in Java Venkat Subramaniam (Agile Developer, Inc) 6:00pm-6:45pm - Moscone South - Room 304 DEV4398 Memory-Efficient Java Kirk Pepperdine (Kodewerk, Ltd) 6:00pm-6:45pm - Moscone South - Room 308 Thursday, September 19 DEV3945 What’s New in Java Security Sean Mullan (Oracle) 9:00am-9:45am - Moscone South - Room 303 BOF3682 The Future of SecurityManager Sean Mullan (Oracle) Andrew Gross (Oracle) 10:00am-10:45am - Moscone South - Room 309 DEV4211 Java Concurrency, A(nother) Peek Under the Hood David Buck (Oracle) 10:00am-10:45am - Moscone South - Room 303 DEV3217 Hunting Down Scalability Bottlenecks in Java Sergey Kuksenko (Oracle) 11:15am-12:00pm - Moscone South - Room 205 DEV3118 Four Productive Ways to Use Open Source JFR and JMC Revisited Sven Reimers (Airbus) Martin Klahn (Airbus) 11:15am-12:00pm - Moscone South - Room 304 DEV4320 Get Rid of OutOfMemoryErrorMessages Poonam Parhar (Oracle) 12:15pm-1:00pm - Moscone South - Room 304 DEV3876 Type Inference: Friend or Foe? Venkat Subramaniam (Agile Developer, Inc) 2:15pm-3:00pm - Moscone South - Room 301 DEV3983 Java 13: Shaping the Future of Java, Faster Aurelio Garcia-Ribeyro (Oracle) Sharat Chander (Oracle) 3:15pm-4:00pm - Moscone South - Room 301

The second annual Oracle Code One conference will soon be here.  Again, it will showcase a wide and deep variety of developer technology initiatives Oracle is investing and participating in…from...

General

Java Magazine on Containers

By Java Magazine Editor Andrew Binstock In our previous issue, we explored the use of lightweight frameworks— Javalin, Micronaut, and Helidon—to create microservices, which typically are deployed in the cloud. In that issue’s article on Helidon, we also showed how to package a service into a Docker container for deployment. In this issue, we continue the theme by examining how to build apps with containers in mind and how to deploy containers. For straight Java apps, the jlink and jdeps tools are excellent solutions for creating modularized, small, self-contained apps. We discuss how to use those tools on page 25. If very fast startup time is a concern, then consider the GraalVM platform. It is written in Java but compiles Java code to an executable format. We’ve discussed GraalVM in past issues, but this article focuses on the latest features and their use in creating small executables with native-code startup speed. Finally, if you’re straddling the Dev and Ops sides of DevOps, you surely have seen that most containers are managed with the open source Kubernetes platform. In our lead feature, we give you a full introduction to Kubernetes and all the information you need to start working with managing your containerized apps. In addition, we explore what’s new in the recent release of Java 12, and we examine a major upgrade to Java Card, which in all senses is the very smallest container for a Java app. In addition, we have our usual quiz and our events calendar. Finally, future issues of this magazine will look materially different from what you’re used to. Please see the editorial in this issue for details

By Java Magazine Editor Andrew Binstock In our previous issue, we explored the use of lightweight frameworks— Javalin, Micronaut, and Helidon—to create microservices, which typically are deployed in...

Java

Java Magazine on Lightweight Frameworks

By Java Magazine Editor Andrew Binstock  Running Fast and Light Without All the Baggage The emergence of microservices as the new architecture for applications has led to a fundamental change in the way we use frameworks. Previously, frameworks offered an omnibus scaffolding that handled most needs of monolithic applications. But as microservices have gained traction, applications now consist of orchestrated containers, each performing a single service. As such, those services require far less scaffolding—favoring instead lightweight frameworks that provide basic connectivity and then get out of the way. In this issue, we examine three leading frameworks for microservices: Javalin (page 13), which is a very lightweight, unopinionated Kotlin-based web framework; Micronaut (page 23), which handles all feature injection at compile time and so loads extremely fast; and Helidon (page 34), which is a cloud native framework that generates a pure Java SE JAR ile that can be run as a service or a complete app. Helidon comes in two flavors: a minimal framework and a slightly heftier one for developers wanting additional services.  In addition to these articles, we continue with the final installment of our series on Java design patterns—this time covering the Proxy pattern (page 53), with practical examples and coverage of the rarely discussed dynamic proxy feature in a little-used corner of the Java language. Ben Evans examines a common optimization in VMs, loop unrolling (page 62), and explains the subtle reason why loops on the JVM will execute more slowly if they’re indexed by longs rather than ints.  And of course we have our quiz—somewhat expanded for this issue (page 81)—and our book review (page 7). 

By Java Magazine Editor Andrew Binstock  Running Fast and Light Without All the Baggage The emergence of microservices as the new architecture for applications has led to a fundamental change in the way...

Java

30 New Java Champions Confirmed in 2018

Java Champions have had an incredibly busy 2018. They have supported their communities by giving over 1400 talks at conferences and user group meetings in over 60 countries.   The efforts of these community experts sharing their knowledge around the would influence countless others, professional engineers and students new to the craft to think in new ways, apply new solutions to problems and enhance, not only the commerce of the organizations they work for but also their own professional growth.    We have also welcomed 30 new Java Champions to the program in 2018, including new members from countries as diverse as Japan, India, South Africa, and New Zealand. Alberto Salazar Alex Theedom Bethan Palmer Christoph Engelbert Claus Ibsen Daniel Bryant Donald Raab Ivan St. Ivanov Jean-Francois Arcand Jim Manico Jonathan Giles Jose Diaz Julien Dubois Ken Fogel Koichi Sakata  Mala Gupta Mani Sarkar Michael Hunger Michael Minella Michael Simons Miroslav Wengner  Nikhil J. Nanivadekar Nitsan Wakart Rafael Chinelato Del Nero Rahman Usta Ray Tsang Roy van Rijn Shin Tanimoto Tomasz Nurkiewicz Victor Orozco Viktor Klang   The full bios of these and all other Java Champions may be found here Information about the Java Champions Program can be found here 

Java Champions have had an incredibly busy 2018. They have supported their communities by giving over 1400 talks at conferences and user group meetings in over 60 countries.   The efforts of these...

Using JShell with NetBeans

By Guess Blogger Deepak Vohra  Java Shell (or JShell) is a new tool introduced in Java 9 for running standalone code snippets.  JShell in NetBeans is explored in six articles. The first article introduces JShell with NetBeans including how to access the JShell.  JShell-only commands such as /list and /save are shell commands to facilitate the use of the tool.  The first article discusses how to run code snippets to import a package or a type. Further, the first article discusses declaring and using variables explicitly. The second article continues with declaring and using variables; implicit variables. Further, code snippets for String comparison and statements are run in the second article. Resetting JShell is also discussed in the second article. The third article is all about running code snippets for methods in JShell. Modifying method definition, method overloading, and making a forward reference to a method are discussed as used in JShell. Some JShell specific features for methods are also discussed including listing code snippets for methods, and method modifiers not permitted in a top-level method declaration. The fourth article is mainly about running code snippets for classes in JShell including declaring a class, modifying a class, using class constructors, extending a class and overriding methods. Further, interfaces, arrays and unchecked exceptions are also discussed. The fifth article discusses running code snippets for enums and the various control flow statements. The sixth article discusses lambda expressions, in addition to discussing saving and loading code snippets in JShell. Using JShell in Java 9 in NetBeans 9.0, Part 1 Using JShell in Java 9 in NetBeans 9.0, Part 2 Using JShell in Java 9 in NetBeans 9.0, Part 3 Using JShell in Java 9 in NetBeans 9.0, Part 4 Using JShell in Java 9 in NetBeans 9.0, Part 5 Using JShell in Java 9 in NetBeans 9.0, Part 6

By Guess Blogger Deepak Vohra  Java Shell (or JShell) is a new tool introduced in Java 9 for running standalone code snippets.  JShell in NetBeans is explored in six articles. The first article introdu...

Java

Java Magazine New Edition: Java Present and Future

There is a lot happening in Java, and in this issue we do our best to make the state of Java as clear as possible. We begin with a survey (page 15) of Java developers. The survey covers JDK, tools in use, processes, and finally a profile of Java developers. We follow that up with a look at Java 11 (page 39), which was released in September: what’s in this release that you need to know about—such as changes to lambda syntax, a new HTTP client, and the updated WebSocket interface. The Java 11 release was the first in several years not to include JavaFX, which has been spun out from the JDK. This means that JavaFX can evolve on its own timeline, which is discussed (page 62) by Johan Vos, one of its principal developers. We also examine upcoming technology from the Valhalla project (page 56), which promises to make it far easier and faster to access primitive data types. This performance enhancement will be particularly welcome when accessing objects in arrays, as Ben Evans explains in his deep look inside the JVM. Finally, the product management team for Java explains recent changes (page 52) to the licensing model. In addition, we have a deep dive into the decorator design pattern (page 67), our quiz (page 78), and our book review (page 8), as well as our calendar of upcoming developer conferences and

There is a lot happening in Java, and in this issue we do our best to make the state of Java as clear as possible. We begin with a survey (page 15) of Java developers. The survey covers JDK, tools in...

Announcing 2018 Duke's Choice Award Winners

In keeping with its 16-year history, the 2018 Duke's Choice Award winners were announced at the Groundbreakers Hub at Code One. The winners include JPoint, a self-driving car;  community winners BgJUG (the Bulgarian JUG) . Among the winners announced were also tools from ClassGraph, Twitter4J, Apache NetBeans and Jelastic vertical memory scaling along with open source initiatives, MicroProfile.IO and Project Helidon.   Apache NetBeans - Toni Epple, Constantin Drabo, Mark Stephens  An integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components and runs on Microsoft Windows, macOS, Linux, and Solaris. Bulgarian Java User’s Group, BgJUG - Dmitry Alexandrov, Nayden Gochev, Ivan St. Ivanov, Mihail Stoynov, Martin Toshev The BgJUG deserves recognition for their mastery of two pillars: the technical side and the community. Influencing the adoption of Java for more than 10 years, the group organizes highly effective events regularly. The passion, dedication, and professionalism at BgJUG are highly contagious. The human aspect, the empathy, the collaborative nature, and the diversity this team consistently promotes is very refreshing. ClassGraph - Luke Hutchison ClassGraph is an uber-fast parallelized classpath scanner, module scanner, and build-time/runtime annotation processor for JVM languages. ClassGraph directly parses class files to build a graph of the relatedness of all visible classes, methods, fields, and annotations, and this graph can be queried or visualized in a wide range of ways, bringing valuable meta programming features to the JVM ecosystem. Jelastic - Ruslan Synytsky  Elastic JVM with Automatic Vertical Memory Scaling allows the JVM to dynamically adjust the maximum memory limit for running Java process without JVM restart, and releases unused memory back to the host machine to save money for companies running workloads in the cloud. JPoint - Bert Jan Schrijver   An autonomous driving vehicle created with Raspberry Pi, an RPi camera, Vert.x (the reactive toolkit for the JVM), and the OpenCV Java bindings.   MicroProfile.io   The MicroProfile project fills a gap in the Java EE ecosystem, allowing developers and vendors to develop and deploy simple, low-profile microservices developed on the Java EE/Jakarta EE Platform. Project Helidon -  Joe DiPol  A set of Java libraries for writing microservices, Helidon supports two programming models. Helidon MP implements MicroProfile for developers familiar with Java EE, and Helidon SE provides a functional and reactive-style API. Both are powered by Netty. Twitter4J - Yusuke Yamamoto   A library based on OAuth, REST API, JSON, and HTTP/2 technology that helps integrate microblogging service in a type-safe way.  

In keeping with its 16-year history, the 2018 Duke's Choice Award winners were announced at the Groundbreakers Hub at Code One. The winners include JPoint, a self-driving car;  community winners BgJUG...

Java

How to Develop Modules with Eclipse IDE

The Java Platform Module System (JPMS) main goal is to make it easier to construct and maintain Java libraries and large applications. You will also experience improved application performance by scaling down the Java SE platform and JDK. In a series of five tutorials, Deepak Vohra explains how to use the module system in your applications. He walks you through setting up your environment, creating classes within modules, configuring VM Args for your module path and running your application. Your application will be portable when you use a module as a JAR file. Deepak explains how to create and export a Java project as a JAR file using Eclipse IDE. The tutorial is a step-by-step guide from setting up your environment to running your application. With the JPMS, you still need to manage your application dependencies, including third-party application dependencies. The last two tutorials detail how to create a module which depends on another module’s dependencies. To use multiple modules, you need to create multiple Java projects in Eclipse because Eclipse does not allow creating multiple modules in one project. The last article describes how to configure the two Java projects and run the main module application to demonstrate module dependency. Links to the 5 articles:  Developing a Module with Java 9 in Eclipse IDE, Part 1 Developing a Module with Java 9 in Eclipse IDE, Part 2 Using a Java 9 Module as a JAR File Using Module Dependencies, Part 1 Using Module Dependencies, Part 2

The Java Platform Module System (JPMS) main goal is to make it easier to construct and maintain Java libraries and large applications. You will also experience improved application performance by...

General

Updates to the Java SE Platform

OpenJDK provides production-ready open-source builds of the Java Development Kit, version 11, an implementation of the Java SE 11 Platform under the GNU General Public License, version 2, with the Classpath Exception. JDK 11.0.1 Download  JDK 11.0.1 Release Notes  License  Java SE 11.0.1 is the latest update to the Java Platform. Java SE 11 is the first Long Term Support feature release for the Java SE Platform  Java SE 11.0.1 release notes Java SE 11.0.1 (LTS) download  Java SE 8u191 (Java SE 8 update 191) and Java SE 8u192 (Java SE 8 update 192)  are now available. Oracle strongly recommends that most Java SE users upgrade to the latest Java 8 update, which includes important security fixes. Oracle will not post further updates of Java SE 8 to its public download sites for commercial use after January 2019. For information on new features and bug fixes included in this release, please read the Java SE 8u191 and Java SE 8u192 release notes.  Oracle Java SE Embedded Version 8 Update 191 is also available. You can create customized JREs using the JRECreate tool. To get started, download an eJDK bundle suitable for your target platform and follow instructions to create a JRE that suits your application's needs. Oracle Java SE 8 Embedded is the final major release of the Oracle Java SE Embedded product. Starting with JDK 9, Oracle doesn't plan to offer a separate Java SE Embedded product download.  Also released are Java SE 7u201 and Java SE 6u211, which are both available as part of Oracle Java SE Support. For more information about those releases, please read the following release notes:  Java SE 7u201 Release Notes Java SE 6u211 Release Notes   

OpenJDK provides production-ready open-source builds of the Java Development Kit, version 11, an implementation of the Java SE 11 Platform under the GNU General Public License, version 2, with the...

General

Working On the Leading Edge

Few programming languages make it past 20 years and still retain high popularity. But Java has managed to remain widely used in many contexts because of its evolution—not just of the language, but of the larger direction of the ecosystem. None of this is clearer than in the advent of GraalVM, an ahead-of-time native compiler for Java code that coincidentally is written in Java and supports many other languages—both JVM-based and native. To understand how to use Graal for your own projects, see our article on page 17. In the enterprise, Java EE has moved out from Oracle’s aegis and is now hosted at the Eclipse. Foundation under the name of Jakarta EE, which we examine in detail (page 26) in anticipation of its upcoming 1.0 release. Much of Java’s success comes from new tools contributed as open source. Hystrix from Netflix is an excellent library for assuring uptime in distributed apps— especially microservices. Our coverage of Hystrix (page 37) shows its benefits and elegance of implementation. Finally, we look at one of the most exciting platform developments: running Java apps on power-sipping ARM processors. As our article (page 54) demonstrates, migration of existing code is not difficult, and on recent chip releases, it does not entail a compromise on performance. We also include the next installment (page 66) of our series on design patterns, this time covering the Visitor pattern. And of course, this issue includes our usual quiz (page 76), editorial (page 5), and a book review (page 8) of an unusually interesting volume. Previous edition of Java Magazine on Libraries, Choosing The Right One 

Few programming languages make it past 20 years and still retain high popularity. But Java has managed to remain widely used in many contexts because of its evolution—not just of the language, but of...

General

Libraries, Choosing the Right One

When developers speak with admiration of the Java ecosystem, they’re referring especially to two things: the abundance of excellent development tools and the vast number of third-party libraries. Libraries are available today to do almost anything that is required, and for the most part, they’re open source and freely available. A quick look at Maven Central—one of the principal repositories for Java artifacts—lists more than 3 million entries, of which nearly 300,000 are unique. That’s a lot of choices! To help you navigate such a wide body of work, we regularly cover libraries in Java Magazine, and once a year we dedicate an entire issue to them. In this issue, we include an annotated list (page 65) of the libraries we’ve covered over the years—it contains everything from cryptocurrency to JVM internals. We also explain the mechanics of library operations. This issue, for example, includes a hands-on discussion of how to convert pre-Java 9 libraries (page 53) to Java modules. In earlier issues, we examined how the JVM finds and loads libraries (PDF), and we explained in depth how best to write libraries. On the following pages, we look at the most popular library for creating PDF files (page 15), explain how to create HTML on the fly (page 27) without using templates, and examine ways to transform Java bytecodes (page 39) in useful ways. We’ve also included another deep dive into a design pattern— this time the State pattern (page 66)—and, of course, we’ve bundled our quiz (page 76) and book review (page 8).

When developers speak with admiration of the Java ecosystem, they’re referring especially to two things: the abundance of excellent development tools and the vast number of third-party libraries....

Java

2018 starts strong for new Java Champions

It’s been a great start to the year for the Java Champion program having added new members from all over the world, New Zealand, Japan, Turkey, Europe, Canada and the USA. This group of talented individuals continue to push the language and platform forward, contributing to JSRs, working on open source Java initiatives and being incredible educators and influencers in their communities. You can find their bios and those of all the other Java Champions here. We are proud to welcome these amazing technologists to the program Alex Theedom Senior Training Instructor at MuleSoft Christoph Engelbert DevRel at Instana, Opensource Enthusiast, Daniel Bryant Independent Technical Consultant, writer, and Editor at InfoQ Donald Raab Managing Director at BNY Mellon Ivan St. Ivanov Senior Programmer at VIDA Software Jean-François Arcand Founder and CTO Asnyc IO Jim Manico Founder of Manicode Security Jonathan Giles Senior Cloud Developer Advocate Microsoft Julien Dubois Chief Innovation Officer at Ippon Technologies Koichi Sakata Software engineer PONOS Corporation Mani Sarkar Polyglot dev, Software Craftsman, speaker, Blogger, dev. communities Michael Minella Senior Manager - Spring Engineering at Pivotal Inc Michael Simons Software Engineer at Neo4j Nikhil J. Nanivadekar Vice President at Goldman Sachs Rahman Usta Senior Software developer Luxoft Ray Tsang Staff Developer Advocate Google Shin Tanimoto Technical Consultant Acroquest Technology Co.,Ltd. Tomasz Nurkiewicz Senior Software Engineer Allegro

It’s been a great start to the year for the Java Champion program having added new members from all over the world, New Zealand, Japan, Turkey, Europe, Canada and the USA. This group of talented...

General

Java Magazine: Design Pattern

By Andrew Binstock, Editor in Chief, Java Magazine When design patterns first appeared in programming via the famous “Gang of Four” book, they represented a breakthrough on two levels. The first was that they provided a prescription for implementing solutions to basic programming problems. In this sense, they defined best practices. They also provided terminology for describing certain solutions: decorators, factories, and singletons, among others. In time, the term “patterns” expanded to cover more than the original 23 instances in that seminal book. It came to refer to best practices for solving a common problem. As a result, the use of patterns proliferated, and they now touch every aspect of computing. In this issue, we launch a series of articles that dig deeply into the most important Gang of Four patterns. Here we start with the Command pattern (page 15) and look at multiple ways to implement it, including across disparate systems. We then look at patterns for using Hibernate and JPA (page 27) and explore the producer-consumer pattern (page 38) as a way to handle large sets of data points in JavaFX. Finally, we examine (page 50) how to map domain-driven design (DDD) entities to Java EE. Separate from patterns, we look at the use of the var keyword (page 63) introduced in Java 10. And we continue our deep dive into the inner workings of the JVM (page 74) by examining how the Java compiler and the JVM remove unneeded locks from threads—and how this explains why performance between StringBuffer and StringBuilder varies so much.

By Andrew Binstock, Editor in Chief, Java Magazine When design patterns first appeared in programming via the famous “Gangof Four” book, they represented a breakthrough on two levels. The first was...

JavaFX

JavaFX WebView Overview

In this blog, we will be looking at how JavaFX can render webpages and the component responsible for it – which is known as WebView JavaFX is a: Software platform for creating and delivering desktop applications, as well as rich internet applications (RIAs) that can run across a wide variety of devices. Set of graphics and media packages that enables developers to design, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms. JavaFX Key Features: WebView: A web component that uses WebKit HTML technology to make it possible to embed web pages within a JavaFX application. JavaScript running in WebView can call Java APIs, and Java APIs can call JavaScript running in WebView. Support for additional HTML5 features, including Web Sockets, Web Workers, and Web Fonts, and printing capabilities have been added in JavaFX. JavaFX WebView: JavaFX WebView is a mini browser (also called as an embedded browser) that provides a web viewer and full browsing functionality through its API  in JavaFX applications. This browser is based on WebKit, that is a open source web browser engine that supports HTML5, JavaScript, CSS, DOM rendering and SVG graphics. The WebView class is an extension of the Node class. The embedded browser inherits all fields and methods from the Node class, and therefore, it has all its features. It encapsulates a WebEngine object, incorporates HTML content into an application's scene, and provides properties and methods to apply effects and transformations. The getEngine() method called on a WebView object returns a Web Engine associated with it. The classes that constitute the embedded browser reside in the javafx.scene.web package. WebView  enables developers to implement the following features in their Java applications: Render HTML content from local or remote URLs Support history and provide Back and Forward navigation Reload the content Apply effects to the web component Edit the HTML content Execute JavaScript commands Perform upcalls from JavaScript to JavaFX Handle events WebView component supports the following HTML5 features apart from supporting CSS3 and ecmascript6 (ES6): DOM3 Canvas Media Playback Form controls (except for <input type="color"> ) Editable content History maintenance Support for the <meter>, <progress>, <details> and <summary> tags SVG Web Sockets Web Workers Support for domain names written in national languages Below diagram depicts architecture of embedded browser and its relation to other JavaFX classes: Web Engine: is a non-visual object capable of managing one Web page at a time Provides basic web page functionality through its API. It supports user interaction such as navigating links and submitting HTML forms, although it does not interact with users directly. It loads Web pages, creates their document models, applies styles as necessary, and runs JavaScript on pages. It provides access  to the document model of the current page, and enables two-way communication between a Java application and JavaScript code of the page. It wraps a WebPage object, which provides interaction with the native Webkit core. Relationship between WebView and WebEngine classes: Code Snippet for Loading content in JavaFX WebView: Create WebView, WebEngine objects and load via Remote URL.: 2. Load Static HTML Content: 3. Loading HTML content from local file: 4. To track Load Progress with the help of LoadWorker: Loading always happens on a background thread. Methods that initiate loading return immediately after scheduling a background job. To track progress and/or cancel a job, we can use the Worker instance available from the getLoadWorker() method. The following example changes the stage title when loading completes successfully:   5. Access to Document Model The WebEngine objects create and manage a Document Object Model (DOM) for their Web pages. The model can be accessed and modified using Java DOM Core classes. The getDocument() method provides access to the root of the model. Additionally DOM Event specification is supported to define event handlers in Java code. The following example attaches a Java event listener to an element of a Web page. Clicking on the element causes the application to exit: 6. Calling Javascript from JavaFX: After WebView loads a website, it is possible to execute arbitrary JavaScript code in the context of the current page using the executeScript(java.lang.String) method. 7.  Mapping JavaScript values to Java objects: JavaScript values are represented using the obvious Java classes: null becomes Java null; a boolean becomes a java.lang.Boolean; and a string becomes a java.lang.String. If the result is a JavaScript object, it is wrapped as an instance of the JSObject class. The JSObject class is a proxy that provides access to methods and properties of its underlying JavaScript object. The most commonly used JSObject methods are getMember (to read a named property), setMember (to set or define a property), and call (to call a function-valued property). A DOM Node is mapped to an object that both extends JSObject and implements the appropriate DOM interfaces. To get a JSObject object for a Node just do a cast: JSObject jdoc = (JSObject) webEngine.getDocument(); 8. Mapping Java objects to JavaScript values: The arguments of the JSObject methods setMember and call pass Java objects to the JavaScript environment. This is roughly the inverse of the JavaScript-to-Java mapping described above: Java String, Number, or Boolean objects are converted to the obvious JavaScript values. A JSObject object is converted to the original wrapped JavaScript object. Otherwise a JavaRuntimeObject is created. This is a JavaScript object that acts as a proxy for the Java object, in that accessing properties of the JavaRuntimeObject causes the Java field or method with the same name to be accessed. Webkit upgrade in JDK: WebView Webkit engine is based Apple Safari Port (https://trac.webkit.org/). This port also being used by iOS,  GTK, WinCairo, EFL etc.. We follow Webkit GTK release cycle and will upgrade Webkit once in 6 months  ( https://trac.webkit.org/wiki/WebKitGTK/StableRelease ) The purpose of upgrading Webkit is to have security vulnerability fixes apart from new features and adhering to latest standards. My next few blogs will cover details of JavaFX WebView architecture and internals of Webkit engine. References: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/web/WebEngine.html https://o7planning.org/en/11151/javafx-webview-and-webengine-tutorial

In this blog, we will be looking at how JavaFX can render webpages and the component responsible for it – which is known as WebView JavaFX is a: Software platform for creating and delivering...

Java

Java Magazine Issue: Microservices and Containers

Application development is continually in the process of moving to new paradigms, either at a high level (mainframe, PC, server, web, mobile, cloud) or a low level, such as the endless succession of web frameworks. While the higher-level trends endure, it’s not always easy to gauge what will survive among the lower-level technologies. In this issue, we examine the high-level trend, containers, and their low-level use, running microservices. Containers are the natural evolution of virtual machines and will surely endure long-term. The natural fit between containers and the cloud drives the popularity of both technologies. Microservices could well evolve quickly into something else. The benefits of loosely coupled services are balanced by the complexity of coding, testing, debugging, and deploying them. As the trade-offs are better understood and computing needs evolve, microservices could well morph into a refined version of current models—that are still likely to be housed in containers on the cloud. We start by showing how to develop a microservice and deploy it in Docker containers (page 15). We then examine the DevOps pipeline for containerized apps (page 32). We compare and combine Java modules and OSGi as intra-application containers (page 42), and finally, we look at Wookiee (page 53), a framework that eliminates a lot of the grunt work in developing microservices. In addition, we examine what’s new in Groovy 3.0 (page 61), continue our series on the mechanics of the JVM (page 73), and look at building an API using Spring (page 81).

Application development is continually in the process of moving to new paradigms, either at a high level (mainframe, PC, server, web, mobile, cloud) or a low level, such as the endless succession of...

What are the Most Popular Libraries Java Developers Use? Based on Github’s Top Projects

By Guest Blogger Henn Idan   GitHub is the most popular git hosting service, letting independent developers host their code for free, or helping enterprise level companies share code within the company. It seems that everyone has used it or using it right now as we speak, which also makes it one of the best sources to identify trends and popularity of repositories and libraries.   And that’s exactly what we at OverOps decided to do; use the site to figure out which are the most popular Java libraries. Using a combination of BigQuery and SQL, we now have the results. Let’s check them out. And the winner is…   The most popular Java library for 2017 is none other than the testing library JUnit. It’s so popular, that it caught the top 3 places of the chart. JUnit is in the first place, followed by JUnit library, the extended JUnit abstract Runner class. And the third place goes to the older junit.framework.   JUnit is not the only testing library that made it into the top 5, and Mockito, the open source mocking framework made it to the 4th place among the most popular Java libraries. And the library that’s closing our top 5 Java libraries of is slf4j, the logging facade for Java.   Hamcrest, a framework that assists writing tests within JUnit and jMock, made it into the 6th place, following the trend we can already see; the need for better testing environments.   The fact that the most popular Java libraries focus on testing is huge. It’s a sign that Java developers put the reliability of their code as a #1 priority. And this is a near and dear topic that I like to cover, especially new ways to produce reliable code, and how to use logs in the best way possible.   What were the biggest trends in the top 100? There are a few well known names in our chart, Guava being one of them. The set of open-source common libraries for Java is super popular among many developers, and we can see 9 different libraries from that family that made it into the top 100:   #7 - com.google.common.collect #9 - com.google.common.base #14 - com.google.common.io #21 - com.google.common.util.concurrent #29 - com.google.common.annotations #41 - com.google.common.cache #42 - com.google.common.primitives #51 - com.google.common.net #62 - com.google.common.hash  We can see that Spring has 8 libraries at the top 100:  #57 – org.springframework.beans.factory.annotation #60 – org.springframework.context #65 – org.springframework.context.annotation #66 – org.springframework.stereotype #68 – org.springframework.util #81 – org.springframework.test.context.junit4 #85 – org.springframework.beans.factory #91 – org.springframework.web.bind.annotation   And Apache has no less than 17(!) libraries that are popular among Java projects:   #16 – org.apache.commons.io #22 – org.apache.http #24 – org.apache.commons.lang #25 – org.apache.http.impl.client #30 – org.apache.http.client #33 – org.apache.http.client.methods #34 – org.apache.log4j #35 – org.apache.commons.codec.binary #45 – org.apache.commons.lang3 #53 – org.apache.http.entity #61 – org.apache.http.util #64 – org.apache.commons.logging #75 – org.apache.http.message #88 – org.apache.zookeeper #95 – org.apache.hadoop.conf #98 – org.apache.http.client.config #100 – org.apache.http.client.utils   And as a little anecdote, Javax, the prefix used for standard Java extensions, has 26 libraries in the chart. Notable names on the chart We also detected some new (and some not-so-new-yet-uprising) libraries that are worth mentioning. The first one that caught our attention was org.w3c.dom, which provides the interfaces for manipulating the DOM (Document Object Model).   Other names that popped up were Coda Hale Metrics, and Objectweb, a small and fast Java bytecode manipulation framework. Joda-Time, which provides a replacement for the Java date and time classes, landed in #46, and the PowerMock support module for JUnit 4.x (org.powermock.modules.junit4) also made an appearance at #85 on the chart.   Another name that’s worth mentioning is AssertJ, a library that provides a fluent interface for writing assertions. While it’s not new, it came up at a nice and cozy place in the middle of the chart, at #50.   Check out the complete list of the top GitHub Java libraries here. How did we crunch the numbers? This information is based on a research we did at OverOps during 2017, in which we used BigQuery to pull the top 1,000 Java repositories from GitHub’s API, according to their star ratings.   We extracted the Java libraries that  these repositories use, and focused on the pure Java projects, which left us with 477 repositories. We took a deep dive into those repositories, after filtering out Android, Arduino and deprecated repos, and were left with 259,885 Java source files.   After prettifying the process (removing duplicate uses of the same library in the same repo), we had a total of 25,788 unique libraries. Out of these libraries we pulled our top 100 list, which is brought before you in this post. You can see the complete list of the top GitHub Java libraries here. What’s coming in 2018? 2018 is going to be a significant year for Java and for its developers. Since the release of Java 9 last September, the whole platform has changed a lot, and the lastest change is moving to a six month release model.   Oracle’s decision to move to a faster release cycle is part of a change we see within the entire industry. Companies, teams and even programming languages are aiming for short release cycles, constantly updating their products and staying up to date with changes and innovations that are relevant to them.   All this considered, it’ll sure be interesting to see which Java libraries will be popular next year, and what kind of impact the new Java release cycle would have on the ecosystem.  

By Guest Blogger Henn Idan   GitHub is the most popular git hosting service, letting independent developers host their code for free, or helping enterprise level companies share code within the company....

Free Three Week Online Course: REST and Java Cloud Service

Are you looking to add REST-based access to your cloud? Rest API can help you create instances, scale, backup and restore. If you have some fundamental knowledge of REST and want to experiment with the cloud. Join this Massive open online course (MOOC) on Java Cloud service using REST.    In this free 3 week course, you will learn about scaling, backup, management and more: Basic REST Concepts(review) Oracle Java Cloud Service Concepts and REST interfaces Stack Manager Principles as they apply to Java Cloud Service and REST Provisioning Java Cloud Service instances using Stack Manager How to start/stop/manage and monitor Java Cloud Services using REST How to backup, patch, scale in/out and up/down Java Cloud Service instances using REST Working with Coherence and Traffic Director using REST. Key Dates Course Start:  04-April-2018 Course Close:  25-April-2018 Quiz Deadline: 02-May-2018   The MOOC format: Available to anyone at no charge.  Self-paced online course with videos available 24/7. No evening calls or travel needed.  Discussions with other students and teacher via the forum.  Each week, one or more lessons will be available, including video materials, homework, and a quiz. After the 3 weeks 
complete the three-course quizzes and score at 70% or higher to receive a completion award. The quiz questions are based on the course materials and homework.       

Are you looking to add REST-based access to your cloud? Rest API can help you create instances, scale, backup and restore. If you have some fundamental knowledge of REST and want to experiment with...

Java

About Serverless and the Fn Project

Why should you consider moving to serverless functions?  Servers are expensive to maintain and during peak times the available servers don’t handle requests fast enough.  Many are moving to cloud environments where the cloud provider manages resources dynamically and pricing is based the amount of resources actually used. Container technologies like Docker give you the flexibility to deploy software on any servers and the scale you need. In the serverless model, you don’t pay for a server; you pay for the amount of time a server is actually used.  Microservices also support serverless computing, because they can be decomposed into small functions and scaled independently. Those functions are stateless and serverless - without any configuration required. Developers can take advantage of serverless infrastructure only if their applications leverage functions.  Announced at JavaOne last year, the Fn project, a container-native platform, is open source, cloud neutral to avoid cloud lock-in, and integrated with Docker containers. In his article, Johan Vos describes the Fn platform and how developers can easily write and maintain Java functions and test them in a standalone environment, or deploy them in a Fn server. He shows examples of functions using Java and Maven, and regardless of the language and build system you use, you can focus on developing your functions without worrying about how to run them in a specific environment.  

Why should you consider moving to serverless functions?  Servers are expensive to maintain and during peak times the available servers don’t handle requests fast enough.  Many are moving to cloud...

Java

Examples and Recipes

By Guest Blogger Chris Hegarty  The following are a number of examples and recipes that can be followed to perform common tasks using the JDK HTTP Client. See here for an introduction to the JDK HTTP Client. Synchronous Get Asynchronous Get Post Concurrent Requests Get JSON Post JSON Setting a proxy Synchronous Get Response body as a String public void get(String uri) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); HttpResponse<String> response = client.send(request, BodyHandler.asString()); System.out.println(response.body()); } The above example uses the asString BodyHandler to convert the response body bytes into a String. A BodyHandler must be supplied for each HttpRequest sent. The BodyHandler determines how to handle the response body, if any. The BodyHandler is invoked once the response status code and headers are available, but before the response body bytes are received. The BodyHandler is responsible for creating the BodySubscriber which is a reactive-stream subscriber that receives streams of data with non-blocking back pressure. The BodySubscriber is responsible for, possibly, converting the response body bytes into a higher-level Java type. The HttpResponse class provides a number of convenience static factory methods for creating a BodyHandler. A number of these accumulate the response bytes in memory until it is completely received, after which it is converted into the higher-level Java type, for example, asString, and asByteArray. Others stream the response data as it arrives; asFile, asByteArrayConsumer, and asInputStream. Alternatively, a custom written subscriber implementation can be provided. Response body as a File public void get(String uri) throws Exception { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); HttpResponse<Path> response = client.send(request, BodyHandler.asFile(Paths.get("body.txt"))); System.out.println("Response in file:" + response.body()); } Asynchronous Get The asynchronous API returns immediately with a CompletableFuture that completes with the HttpResponse when it becomes available. CompletableFuture was added in Java 8 and supports composable asynchronous programming. Response body as a String public CompletableFuture<String> get(String uri) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); return client.sendAsync(request, BodyHandler.asString()) .thenApply(HttpResponse::body); } The CompletableFuture.thenApply(Function) method can be used to map the HttpResponse to its body type, status code, etc. Response body as a File public CompletableFuture<Path> get(String uri) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); return client.sendAsync(request, BodyHandler.asFile(Paths.get("body.txt"))) .thenApply(HttpResponse::body); } Post A request body can be supplied by an HttpRequest.BodyPublisher. public void post(String uri, String data) throws Exception { HttpClient client = HttpClient.newBuilder().build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .POST(BodyPublisher.fromString(data)) .build(); HttpResponse<?> response = client.send(request, BodyHandler.discard("")); System.out.println(response.statusCode()); } The above example uses the fromString BodyPublisher to convert the given String into request body bytes. The BodyPublisher is a reactive-stream publisher that publishes streams of request body on-demand. HttpRequest.Builder has a number of methods that allow setting a BodyPublisher; Builder::POST, Builder::PUT, and Builder::method. The HttpRequest class has a number of convenience static factory methods that create a BodyPublisher for common types of data; fromString, fromByteArray, fromFile. The discard BodyHandler can be used to receive and discard the response body when it is not of interest. Concurrent Requests It's easy to combine Java Streams and the CompletableFuture API to issue a number of requests and await their responses. The following example sends a GET request for each of the URIs in the list and stores all the responses as Strings. public void getURIs(List<URI> uris) { HttpClient client = HttpClient.newHttpClient(); List<HttpRequest> requests = uris.stream() .map(HttpRequest::newBuilder) .map(reqBuilder -> reqBuilder.build()) .collect(toList()); CompletableFuture.allOf(requests.stream() .map(request -> client.sendAsync(request, asString())) .toArray(CompletableFuture<?>[]::new)) .join(); } Get JSON In many cases the response body will be in some higher-level format. The convenience response body handlers can be used, along with a third-party library to convert the response body into that format. The following example demonstrates how to use the Jackson library, in combination with BodyHandler::asString to convert a JSON response into a Map of String key/value pairs. public CompletableFuture<Map<String,String>> JSONBodyAsMap(URI uri) { UncheckedObjectMapper objectMapper = new UncheckedObjectMapper(); HttpRequest request = HttpRequest.newBuilder(uri) .header("Accept", "application/json") .build(); return HttpClient.newHttpClient() .sendAsync(request, asString()) .thenApply(HttpResponse::body) .thenApply(objectMapper::readValue); } class UncheckedObjectMapper extends com.fasterxml.jackson.databind.ObjectMapper { /** Parses the given JSON string into a Map. */ Map<String,String> readValue(String content) { try { return this.readValue(content, new TypeReference<>(){}); } catch (IOException ioe) { throw new CompletionException(ioe); } } The above example uses asString which accumulates the response body bytes in memory. Alternatively, a streaming subscriber, like asInputStream could be used. Post JSON In many cases the request body will be in some higher-level format. The convenience request body handlers can be used, along with a third-party library to convert the request body into that format. The following example demonstrates how to use the Jackson library, in combination with the BodyPublisher::fromString to convert a Map of String key/value pairs into JSON. public CompletableFuture<Void> postJSON(URI uri, Map<String,String> map) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); String requestBody = objectMapper .writerWithDefaultPrettyPrinter() .writeValueAsString(map); HttpRequest request = HttpRequest.newBuilder(uri) .header("Content-Type", "application/json") .POST(BodyPublisher.fromString(requestBody)) .build(); return HttpClient.newHttpClient() .sendAsync(request, BodyHandler.asString()) .thenApply(HttpResponse::statusCode) .thenAccept(System.out::println); } Setting a Proxy A ProxySelector can be configured on the HttpClient through the client's Builder::proxy method. The ProxySelector API returns a specific proxy for a given URI. In many cases a single static proxy is sufficient. The ProxySelector::of static factory method can be used to create such a selector. Response body as a String with a specified proxy public CompletableFuture<String> get(String uri) { HttpClient client = HttpClient.newBuilder() .proxy(ProxySelector.of(new InetSocketAddress("www-proxy.com", 8080))) .build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); return client.sendAsync(request, asString()) .thenApply(HttpResponse::body); } Alternatively, the system-wide default proxy selector can be used, which is the default on macOS. HttpClient.newBuilder() .proxy(ProxySelector.getDefault()) .build();

By Guest Blogger Chris Hegarty  The following are a number of examples and recipes that can be followed to perform common tasks using the JDK HTTP Client. See here for an introduction to the JDK HTTP...

General

Java Magazine: Reactive Programming

By Java Magazine Editor Andrew Binstock Reactive programming is a term that means slightly different things to different people. Central to the concept, though, is a model of computing that is alerted to certain kinds of events, can process or ignore those events, and works with the event source to manage the number of events to be processed. In practice, this model rests on several technologies: a message-passing framework, a subscription-based notification system, and an asynchronous execution of the event-driven tasks. The benefit is a loosely coupled implementation that is scalable and tends to isolate failures. The scalability here refers to the ability to scale horizontally quickly, and it anticipates handling the number of events associated with big data—millions to billions of incoming events. This aspect, in particular, is what makes the reactive model different from its familiar forebear, the event loop in GUI development. In this issue, we provide an overview of reactive development (page 16) and then do a deep dive into RxJava (page 32), one of the leading libraries for developing reactive applications on the JVM. We follow that up by looking at the reactive capabilities built into the most recent release of Spring 5.0 (page 61). Finally, we examine a slightly different model for developing CRUD applications, called Command Query Responsibility Segregation, or CQRS (page 69), which while not reactive per se implements an approach that overlaps with reactive programming. It might seem that reactive programming is a design that would lead naturally to microservice implementation. And indeed it is.

By Java Magazine Editor Andrew Binstock Reactive programming is a term that means slightly different things to different people. Central to the concept, though, is a model of computing that is alerted...

General

Modular Development with JDK 9

What does strong encapsulation mean in JDK 9?  How do you migrate your current application to modules? Alex Buckley explains in great detail the key concepts behind modules.  He describes how the module system can improve the structure of your code, how you can migrate your application progressively by mixing modular and non-modular code, and how a modular JDK enables better compatibility.   With JDK 9, you can still run your applications on the classpath. The new module system is built into the Java language and the virtual machine. Your applications and the libraries you use can be packaged, tested and deployed as modules managed by the module system. A module is essentially a set of packages that make sense being grouped together and is designed for reuse.  Since the full platform is modular, the modular system is more reliable, easier to maintain and secure. Those benefits are shown in examples described through out this presentation.   The main goals of the module system are to improve security with strong encapsulation and stability with reliable dependencies. Before JDK 9, you could not fine tune public access restrictions and many APIs got exposed. Modules have concealed packages for internal use and exported packages for shared code with other modules. You can also specify which classes can be shared with which modules or you can set them to be accessible to any modules. Public on a class declaration no longer means accessible to everyone.  How do you migrate an existing application? You probably won't migrate an entire application to the module system all at once. Code in modules and traditional JARs on the classpath will coexist in your applications. Java 9 has tools to ease the migration. For example, jdeps helps you find Java class dependencies -  You run jdeps tool on the application jars.  It scans class files or jar files and tells you what code from other jar files that code depends on - You don’t have to change your traditional JARs file to run them on the module path. While demonstrating the migration of a simple JSON application, Alex explains in great detail how to define module requirements using jdeps, how to automatically create modules, export them and much more.     Chapters to help you navigate the video content: Part 1: Programming in the Large (2:12) Java Base Module (5:40) Encapsulation in JDK 9 (6:30) Running a Modular application (13:56) Maven and JDK 9 (16:05) Part 2: Migrating to Modules (24:56) Automatic Modules (32:19) Key points to remember about the Migration to Modules (34:08) Part 3: Modular JDK (34:30) Compatibility with the Modular JDK (37:15) Modular JDK Summary (39:37) Related blogs:  Get Ready for Java 9 JDK 9 Language, Tooling and Library Features  More information about module system and JDK 9 can be found online:  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Related blog: Modular Development with JDK 9  Two editions of Java Magazine are dedicated to Java 9. Register for free! 

What does strong encapsulation mean in JDK 9?  How do you migrate your current application to modules? Alex Buckley explains in great detail the key concepts behind modules.  He describes how the...

Java Champions

New Java Champions in 2017

2017 has been a great year for new Java Champions. It has been a year of awesome activity with over 40 new Java Champions accepted into the program. Java Champions have been busy recording video interviews, Reddit AMAs, Blog posts, speaking at JavaOne, speaking at Code events worldwide, speaking at third-party development conferences, participating in User Group meetings and Meetups and participating in Oracle Code Online.  New Java Champions in 2017 Aleksey Shipilev Alex Soto Alexis Lopex Antoine Sabot-Durand Bauke Scholtz Bert Jan Schrijver Bob Paulin Cagatay Civici Christopher Judd Chris Newland David Heffelfinger  Dmitry Aleksandrov Eder Ignatowicz Emmanuel Bernard Fernando Babadopulos Gail Anderson Gil Tene Guillaume Laforge Holly Cummins Ix-chel Ruiz Jose Pereda Josh Juneau Ken Kousen Kito Mann Konrad Malawski Leonardo de Moura Rocha Lima Michael Heinrichs Monica Beckwith Neil Griffin Oleg Shelajev Oliver Gierke Paul Anderson Paul Bakker Rabea Gransberger Raoul-Gabriel Urma Rick Hightower Roman Kennke Rustam Mehmandarov Sander Mak Sean M. Phillips Vlad Mihalcea   Aleksey Shipilev Aleksey Shipilev is a principal software engineer at Redhat. He is the author of the Java Microbenchmarking Harness (JMH), a project to examine the performance of Java coding constructs.  Prior to JMH, programmers wrote their benchmarking harnesses fraught with errors.  He wrote JCStress, a toolkit for testing concurrency code. He also developed a Java-Object-Layout, JOL, which uses Unsafe, JVMTI, and Serviceability Agent (SA) heavily to decode the actual object layout, footprint, and references.  Aleksey is now a committer to the new GC project Shenandoah. He is very active on mailing lists like Java Concurrency Interest, JMH, and OpenJDK projects. Follow him on Twitter @shipilev Alex Soto Alex Soto (Spain) is a software engineer at Red Hat. He is a passionate about Java world, software automation and he believes and has contributed to several open source software model projects. Alex is the creator of the NoSQLUnit project and member of JSR374 (Java API for JSON Processing) Expert Group. Currently, Alex is a co-author of Testing Java Microservices book for Manning and international speaker talking about Java ecosystem. Alexis Lopez Mr. Lopez is an independent consultant. He has been a university Java professor and speaker at several conferences including Oracle Open World, JavaOne, Campus Party and OTN/ODT Tour. He earned a B.S. in Computer Systems Engineering and holds the following certifications and recognitions: Oracle Ace, Java Champion, Duke Choice Award, OCP Java 8, OCPJMAD, OCPWCD and Oracle ADF Implementation Specialist. He is leader of the Cali Java Users Group (www.clojug.org), member of the JEspañol (www.jespanol.org) steering committee and an active blogger at www.acelopez.com. In recent years, Mr. Lopez has been architecting Web applications for his clients and has helped them to adopt good development practices, such as continuous integration. Antoine Sabot-Durand Antoine Sabot-Durand lives in France where he had been running his own consulting company for twelve years before joining Ippon a famous french IT company. During his consulting years, he learned a lot about programming and architecture with various customers (Startups, Bank, Insurance, Pension funds or Automotive), mainly on the Java and Java EE platform. He joined Red Hat in 2013 to take the role of CDI specification lead. He started to work on CDI 1.2 MR in 2014, and then took the lead on the CDI 2.0 expert group and released it early 2017. Now he is focused on the Microprofile and EE4J specifications. Bauke Scholtz Bauke Scholtz is a member of JSF 2.3 Expert Group and the co-founder of the JSF helper library OmniFaces. In 2015, OmniFaces won the Duke's Choice award. The source for OmniFaces is available under his GitHub handle: github.com/BalusC. Bauke is also the co-founder of zeef.com, a popular new social search engine built with Java EE 7. Zeef's content relies on contributors' expertise and their status in the community. Bauke’s page has links to the most relevant JSF information jsf.zeef.com/bauke.scholtz. Adam Bien wrote a detailed blog about the inner workings of Zeef. Known as BalusC,  Bauke ranks third in the user reputation ranking of Stackoverflow with nearly 17,000 answers. Bauke blogs about JSF, Java EE, and Java EE frameworks at balusc.omnifaces.org. He was one of the heroes of Java in Markus Eisele’s series and was interviewed in 2012. Follow him on Twitter @OmniFaces Bert Jan Schrijver Bert Jan Schrijver is a senior developer at JPoint. A tireless community organizer, he organizes J-Fall, the biggest Java conference in the Netherlands as well as the IoT Tech Days, a one-day conference on smart technologies. He is the chief editor of Java Magazine in the Netherlands, which has 4,000 subscribers.  Bert Jan worked with the JCP to have NLJUG join the Adopt-a-JSR program. The NLJUG was nominated as ‘outstanding adopt-a-jar participant’ for the JCP awards this year. Just in the past year, Bert Jan helped the Utrecht and Amsterdam JUGs start up their user groups. Bert Jan is always eager to share experiences with other JUG leaders and he helps out at Devoxx4Kids workshop to teach kids how to code Bob Paulin Bob Paulin is an independent consultant working for different IT firms. He has 15 years of experience as a developer and has contributed to open source software for the past 10 years. Bob is currently an ASF member and actively contributes to Apache Tikka, Apache Felix, and Apache Sling. He was nominated as JCP Outstanding Adopt-a-JSR participant for his involvement with Java EE 8. He has run numerous JDK 9 workshops in the Chicago area.  Bob is the co-host the JavaPubHouse.com, a podcast on a range of Java topics, standards, tools, and techniques. He also participates regularly in the Java Off-Heap, a podcast about Java technology news.  Bob has run the Devoxx4Kids and GotoJr conferences in Chicago allowing kids to hack in Minecraft, play with Lego robots, and use conductive play-doh. These efforts have enriched the lives of students and are helping inspire students to pursue technical careers. Follow him on Twitter @bobpaulin Cagatay Civici Çağatay Çivici is a member of JavaServer Faces Expert Group, the founder and project lead of popular PrimeFaces Component Suite and PMC member of open source JSF implementation Apache MyFaces. He’s a recognized speaker at international conferences such as JavaOne, SpringOne, JAX, Jazoon, Confess, JSFSummit and many local events such as JUGs. Cagatay is also an author and technical reviewer of a couple of books regarding web application development with Java and JSF. As an experienced trainer, he has trained over 300 developers on Java EE technologies mainly JSF, Spring, EJB 3.x and JPA. Cagatay is currently working as a consultant, mentor, and instructor for Prime Teknoloji in Turkey. Christopher Judd Christopher Judd is CTO and partner at Manifest Solutions (http://www.manifestcorp.com), an international speaker, an open source evangelist, and the Central Ohio Java Users Group (http://www.cojug.org) leader.  He is an accomplished writer having co-authored Beginning Groovy and Grails (Apress, 2008), Enterprise Java Development on a Budget (Apress, 2003) and Pro Eclipse JST (Apress, 2005) as well as the author of the children’s book “Bearable Moments”.  Based in Columbus Ohio USA, he has spent over 20 years architecting and developing software for organizations ranging from Fortune 500 to start-ups across various industries including insurance, healthcare, education, retail, government, manufacturing, service, and transportation.  Mr. Judd spends most of his time consulting while continuing to focus on mentoring and training in Java, mobile, and related technologies. Chris Newland Chris Newland is a senior developer and team lead at ADVFN using Java to process stock market data feeds in real time. In his spare time, he invented and still leads developers on the JITWatch project, an open source log analyzer to visualize and inspect Just-In-Time compilation decisions made by the HotSpot JVM. Chris is also a JavaFX developer and built a performance benchmark called DemoFX.  He set up a community OpenJFX backend at http://chriswhocodes.com/ for cross-platform builds so that OpenJFX can be used with ARM JDKs and OpenJDK-based builds from other vendors such as Azul Systems' Zulu JDK. David Heffelfinger David Heffelfinger is an independent consultant based in the Washington, DC area. He is a member of the NetBeans Dream Team and is part of the JavaOne content committee.  David has written 7 books on Java EE, application servers, NetBeans, JasperReports, and Wicket. His titles include Java EE 7 Development with NetBeans 8, Java EE 7 with GlassFish 4 Application Server, and JasperReports 3.5 For Java Developers.  David has been speaking at JavaOne every year since 2012. He is a frequent speaker at NetBeans Day in San Francisco, showcasing NetBeans features that greatly enhance the development of Java EE applications. Follow him on Twitter @ensode Dmitry Aleksandrov Dmitry is a principal expert developer living in Sofia, Bulgaria. He has more than a decade experience mainly in Java Enterprise in banking/telecom, but interested in dynamic languages on JVM and features like massive computations on GPUs. He is a frequent contributor to open source and community-driven initiatives. He is a co-lead of the Bulgarian Java User Group and co-organizer of jPrime Conf. – one of the biggest community-driven conferences in the Balkans region. Dmitry is a blogger and also a conference speaker at local events as well as conferences like JavaOne, Devoxx/Voxxed, and Joker. He is doing his best to support disabled people to become industry professionals. Available on twitter - https://twitter.com/bercut2000. Eder Ignatowicz Eder Ignatowicz is Senior Software Engineer at JBoss by Red Hat, a proud member of Drools/jBPM team.  Since joining Red Hat he has been focusing on web-enabled of the Drools&jBPM platforms. Eder is a frequent Java speaker at Brazilian national events (QCon São Paulo and Rio, JavaOne, DevCamp, JustJava, The Developers Conference) and international conferences such as JavaOne. He is also the Program Committee Chair of QCon's in Brazil. Emmanuel Bernard Emmanuel Bernard is a data platform architect at JBoss. He has been a contributor and lead of open source projects for over 15 years and has led the Hibernate portfolio since 2008. He also contributed to JPA specs as JCP EG member and the Bean Validation spec as JSR Spec Lead.  He is the author of Hibernate Search in Action, a reference guide for Hibernate Search. Aside from speaking at Java conferences around the world, he runs two podcasts, JBoss Community Asylum, and the French podcast, “Les Cast Codeurs”. Fernando Babadopulos Fernando Babadopulos is a Brazilian software architect, entrepreneur, and enthusiast of new technologies; he was responsible for developing some of the most popular web applications in Brazil and abroad. With more than 15 years of experience with the internet, Babadopulos specializes in the creation and design of high-performance systems. He was a pioneer in using Java for Big Data applications and He is a frequent speaker and participant in developer conferences worldwide. He holds a master's degree in information engineering from the Federal University of ABC and a BS in computer science from the University Center of FEI. Gail Anderson Gail Anderson is the Director of Research and founding member of the Anderson Software Group, a leading provider of training courses in Java 8, JavaFX, and other programming languages. Gail enjoys researching and writing about leading-edge Java technologies. She is the co-author of eight textbooks on software programming, including JavaFX Rich Client Programming on the NetBeans Platform. Gail has conducted technical sessions and hands-on labs at JavaOne and NetBeans Day conferences in San Francisco, Europe, and Latin America. Gail is a member of the NetBeans Dream Team.   For more information about Gail, visit asgteach.com, the Anderson Software Group on Facebook, and @gail_asgteach on Twitter. Gil Tene Gil Tene is CTO and co-founder of Azul Systems. He has been involved with virtual machine and runtime technologies for the past 25 years. His pet focus areas include system responsiveness and latency behavior. Gil is a frequent speaker at technology conferences worldwide, and an official JavaOne Rock Star. He pioneered the Continuously Concurrent Compacting Collector (C4) that powers Azul's continuously reactive Java platforms. In past lives, he also designed and built operating systems, network switches, firewalls, and laser-based mosquito interception systems. Guillaume Laforge At Google, Guillaume Laforge is Developer Advocate for the Google Cloud Platform, where he spread the word about the rich set of products and services offered for developers wishing to take advantage of the cloud for their projects and businesses. Before joining Google, at Restlet, Guillaume was taking care of the Product Leadership around the APISpark API management platform, the Restlet Studio for crafting Web APIs and the Restlet Framework for authoring restful applications. He is also leading the Developer Advocacy team, to interact with developers using those projects. Since 2003, Guillaume has been involved in the Apache Groovy programming language project, leading the project since about 2004, and working on it under the umbrella of G2One (our Groovy/Grails startup), then SpringSource, VMware, and the Pivotal spin-off. Guillaume accompanied the move of the project to the Apache Software Foundation, where he has the role of Chair of the Apache Groovy Project Management Committee (PMC). He initiated the creation of the Grails web application framework and founded the Gaelyk project, a lightweight toolkit for developing applications in Groovy for Google App Engine.  He is also a frequent conference speaker presenting Serverless technologies, Machine Learning APIs, conversational interfaces, Google Cloud projects & services, Apache Groovy, Grails, Gaelyk, Domain-Specific Languages, Web API design, at JavaOne, JAX, GR8Conf, Greach, DevTernity, SpringOne2GX, QCon, Cloud Next, Voxxed Days and Devoxx, among others.  Guillaume also co-authored Groovy in Action along with Dierk König and Paul King, two famous Apache Groovy committers. Before founding G2One, which was acquired by SpringSource in late 2008, and taking the role of VP Technology, Guillaume worked for OCTO Technology, a consultancy focusing on architecture and agile methodologies. While at OCTO, Guillaume developed new offerings around Groovy and Grails for its customers. Guillaume is also one of the founding members of the French Java/OSS/IT podcast Les Cast Codeurs. Holly Cummins Holly Cummins has been a Java engineer since 2001. She was one of the core engineers on the IBM J9 JVM working on Garbage Collection (GC) and Just in Time (JIT) compilation. She is currently a technical lead for IBM BlueMix Garage.    Holly is also a committer and PMC member on the Apache Aries project, which melds the OSGi and Java EE programming models. She created several wearable projects connected to a backend server to demonstrate the low power requirements of modern application servers, and the suitability of Java for embedded application servers. Holly is the co-author of Enterprise OSGi in Action (Manning). She has published on a range of subjects, from performance myths, garbage collection tuning principles, enterprise OSGi, Java on Raspberry PIs, microservices, automation, and the importance of fun in a development culture. She is a frequent speaker at conferences including Devoxx and JavaOne. Follow her on Twitter @holly_cummins Ix-chel Ruiz Ixchel has developed software application & tools since 2000. Her research interests include dynamic languages, testing, and client-side technologies. Systems Administration (*nix on the top), Data Modeling and AI are among her career passions. She is a believer in open source and has participated in open source projects (Json-lib, EZMorph). Ix-chel is an active member of the Hackergarten and Groovy communities, helping developers throughout the world getting into Open Source and Java/Groovy technologies. She has also been teacher of Computer Science courses in the most prestigious education institute in Mexico Jose Pereda José Pereda, Ph.D. in Structural Engineering, works as a software engineer at Gluon Software. Java Champion and Oracle Developer Champion, JavaOne RockStar and NetBeans Dream Team member. Being on Java since 1999, he is a JavaFX advocate, developing Java applications for mobile and embedded platforms connected to the cloud and enterprise systems, while he also works on open source projects (JFXtras, FXyz3D, https://github.com/jperedadnr), co-authoring JavaFX books (JavaFX 8 Introduction by Example, JavaFX 9 by Example), blogging (http://jperedadnr.blogspot.com.es/), tweeting (@JPeredaDnr) or speaking at JUGs and conferences (JavaOne, Devoxx, JAX, Jfokus, JavaLand, JCrete, JBCNConf,…). José lives with his wife and kids in Valladolid, Spain, and in his spare time he plays basketball, goes for a walk or rides his bike with his family. Josh Juneau Josh Juneau is an application developer and system analyst at Fermilab. He has written numerous books on JSF, Java 8 Recipes, Java EE 7, and Jython. He is the project lead for DJango-Jython and Jython. He is also involved in JSR-371/JSR-366 Josh has been very active in the Chicago Java Users Group for years. Under his leadership, CJUG got involved with Adopt-A-JSR; he received the JCP's Outstanding Adopt-a-JSR participant award. He has been a fervent advocate for Java EE in his blog (http://jj-blogger.blogspot.in/2016/04/java-ee-8-what-is-current-status-case.html).  Josh is a technical writer for Java Magazine and OTN Content. He is a frequent JavaOne speaker and has published more than five books under Apress. He is also a regular in the Java OffHeap podcast, in which he and three others discuss current Java Technology news, trends, and risks. Follow him on Twitter @javajuneau Ken Kousen Ken Kousen is the author of the books Modern Java Recipes (O'Reilly), Gradle Recipes for Android (O’Reilly) and Making Java Groovy (Manning), as well as O’Reilly video courses in Android, Groovy, Gradle, Advanced Java, and Spring, all available through Safari Books Online. He is a regular speaker on the No Fluff, Just Stuff conference tour and a 2013 and 2016 JavaOne Rock Star, and has spoken at conferences all over the world. Through his company, Kousen I.T., Inc., he has taught software development training courses to thousands of students. He also has far too many academic degrees, including a BS in Mathematics and a BS in Mechanical Engineering from M.I.T., an MA and a Ph.D. in Aerospace Engineering from Princeton, and an MS in Computer Science from R.P.I, but despite all that he still believes he can code. Kito Mann Kito D. Mann is the Principal Consultant at Virtua, Inc. (http://virtua.tech), specializing in enterprise application architecture, training, development, and mentoring with PrimeFaces, JavaServer Faces, Java EE, and front-end technologies (Web Components, Polymer, Angular). He is also founder and editor-in-chief of JSFCentral.com(www.jsfcentral.com), co-host of the Enterprise Java Newscast (http://www.enterprisejavanews.com), and the author of JavaServer Faces in Action (Manning). Mann has participated in several Java Community Process expert groups (including CDI, JSF, MVC, and Portlets) and is also an internationally recognized speaker. He holds a BA in Computer Science from Johns Hopkins University and lives in Glen Allen, VA, USA with his wife, son, and daughter.   Konrad Malawski Konrad has focused his career on high performance and clustered systems. He is experienced in navigating corporate structures (e.g. eBay) as well as small agile startups (e.g. Softwaremill). Currently focused on making developing distributed applications accessible and simpler thanks to the Akka toolkit and Scala language, at Typesafe, the company behind those. Notable community/conference work: Program committee member of Java One San Francisco for the JVM Languages track. Part of the leadership team of the annual GeeCON conference along (also helping with the Prague and Tricity editions). Frequent and high rated speaker at well-known conferences such as JavaOne, JFokus, Devoxx and various other smaller conferences. Founded and led (still leading) various user groups, including the GDG Kraków, Kraków Scala User Group, Software Craftsmanship Kraków (the computer science whitepaper reading club) well as the Polish Java User Group. Actively giving back to the community by contributing to various open source projects (also before my time in an open source team) and other activities - including founding and helping hands on in teaching activities for younger ones (founded and run Geecon 4 Kids 2 years). Leonardo de Moura Rocha Lima Leonardo Lima, CTO of V2COM, has been working with Java solutions since 2005, architecting and building V2COM solutions for Industrial Internet of Things. For its extensive use of Java, V2COM’s platform received the Oracle Excellence Award in 2013. Leonardo is also V2COM’s representative at the Java Community Process Executive Committee, where he led a JSR (JSR 363, Units of Measurement) and fosters the usage of Java usage on both embedded and server environments. Leonardo is from Campinas, Brazil, and currently lives in Austin, TX and is actively contributing to JNoSQL and Eclipse Collection projects. Michael Heinrichs Michael is a user interface creator by passion. He is convinced: no matter which technology and which device if it has a screen, one can build a truly amazing experience. And pure magic. He works at the Canoo Engineering AG as a software engineer on next-generation user interfaces. Prior to that, he worked on a low latency trading platform at Barclays Capital. Before that, Michael was responsible for performance optimizations in JavaFX Mobile at Sun Microsystems and later became the technical lead of the JavaFX core components at Oracle.  Michael loves to spend time with his family and cooking. He lives in Freiburg, in the south-west of Germany. You can find him on Twitter @net0pyr and occasionally he blogs at https://netopyr.com. Monica Beckwith Monica Beckwith (USA) has a Master's in Electrical and Computer Engineering and is a Java performance engineer specializing in OpenJDK/OracleJDK HotSpot. She has made various contributions to HotSpot's Virtual Machine (Java VM) and Garbage Collectors (GCs). Monica provides consultancy through Code Karam LLC and has co-authored the 'Java Performance Companion' book. She is currently working on 'Inside Java 9' to be released in early 2018 by Addison Wesley. She is also the author of 'Advanced Java Performance: Hotspot GC Tuning LiveLessons'. Monica, a JavaOne RockStar, is a regular speaker at various universities, institutions, conferences, and podcasts. She also frequently publishes articles related to the field of Java and Java VM/GC internals. Monica is passionate about STEM and loves volunteering her time in coaching kids in the field of (Java) programming and more recently, Lego Robotics. Neil Griffin Neil Griffin is a Software Architect for Liferay in the US and is the project lead for Liferay Faces. Neil has over 20 years of experience in software engineering and represents the company as the Specification Lead on JSR 378 (Portlet 3.0 Bridge for JSF 2.2). He also represents Liferay on JSR 362 (Portlet 3.0) and JSR 372 (JSF 2.3). Neil is a contributing author to the JSF 2.0 Complete Reference, published by McGraw-Hill. Oleg Shelajev Oleg Šelajev is a software engineer, author, and developer advocate at ZeroTurnaround. He's helping to lead VirtualJUG, co-founded a GDG chapter in Tartu, Estonia, and maintains ZeroTurnaround's blog RebelLabs. In his spare time, he is "pursuing" a Ph.D. in dynamic system updates and code evolution. Once upon a time, Oleg was a part-time lecturer at the University of Tartu and now enjoys speaking, teaching, and participating in Java conferences all over the world. In his other free time, Oleg plays chess, loves puzzles and solving all kinds of problems.  Oliver Gierke Oliver Gierke is leading the Spring Data project at Pivotal. He is an active member of the JCP expert group on JPA 2.1 and one of the main organizers of the JUG Saxony Day, OOP, JAX and WJAX conferences. Oliver coined the Spring Data repository programming model which is a widely used Java abstraction to develop data access layers for relational and non-relational databases. This simplifies the way Java developers interact with persistence technologies as Spring Data provides an abstraction over APIs such as JPA. He is one of the leading experts on JPA and other persistence technologies. With Spring Data REST, he helped Java developers implement REST APIs. He also coined the Spring HATEOAS module and helped Java developers use hypermedia elements in REST APIs when using Spring MVC or JAX-RS. Oliver is a consulting lecturer at the Chair of Software Engineering at TU Dresden helping students to get started with application development in Java. All of his material is available online: http://static.olivergierke.de/lectures/ This makes it easy for student developers to experiment with Java and receive a professional introduction to the language and Java development practices.  Oliver contributes almost daily to diverse Open Source frameworks on Github, see https://github.com/olivergierke.  He is a frequent speaker at many conferences including BEDcon, OOP, JavaZone, Devoxx, SpringOne, JavaOne, JFokus, Øredev to name a few. Follow him at @olivergierke Paul Anderson Paul Anderson is the Director of Training and founding member of the Anderson Software Group, a leading provider of training courses in Java 8, JavaFX, and other programming languages.  He is an experienced speaker and specializes in making the technical aspects of software engineering fun and understandable. He is the co-author of eight textbooks on software programming, including JavaFX Rich Client Programming on the NetBeans Platform. Paul is a frequent speaker at JavaOne and NetBeans Day conferences in San Francisco, Europe, and Latin America. Paul is a member of the NetBeans Dream Team and the author of LiveLesson videos on JavaFX Programming and Java Reflection.   For more information about Paul, visit asgteach.com, the Anderson Software Group on Facebook, and @paul_asgteach on Twitter. Paul Bakker Paul started his Java career building Applets while still in high school in the Netherlands. 15 years or so later he lives in the Bay Area working for Netflix. He has published two books, "Modular Cloud Apps with OSGi" and "Java 9 Modularity" and has given countless talks at Java conferences around the world. Rabea Gransberger Rabea studied computer science and got a diploma in 2008. She is co-leading the software development department and is working as a software engineer on various Eclipse RCP based projects at MEKOS in Bremen, Germany. Her main focus is on keeping the code base clean and educating the team on how to write better code. Rabea is a well-known speaker at conferences and user groups around the world. She started the Java user group Bremen in 2012 and is part of the organization team ever since. Besides software development, she likes to watch football games in the local Weserstadium. Raoul-Gabriel Urma Raoul-Gabriel Urma is CEO and co-founder of Cambridge Spark, a leading learning community for data scientists and developers in UK. In addition, he is also Chairman and co-founder of Cambridge Coding Academy, a growing community of young coders and pre-university students. Raoul is the author of the bestselling programming book “Java 8 in Action” which sold over 20,000 copies globally. Raoul completed a Ph.D. in Computer Science at the University of Cambridge. In addition, he holds a MEng in Computer Science from Imperial College London and graduated with first-class honors having won several prizes for technical innovation. Raoul has delivered over 100 technical talks at international conferences. He has worked for Google, eBay, Oracle, and Goldman Sachs. He is also a Fellow of the Royal Society of Arts. Rick Hightower Rick consults and does contract development for high-speed computing, Java-based uServices, Apache Spark, Apache Kafka, and Apache Cassandra. He also writes about microservice development and reactive streaming. Rick is a frequent speaker regarding high-speed, reactive microservice development and has spoken recently at JavaOne as well at FinTech at scale in SF.  He specializes in high-speed, in-memory, non-blocking, microservices development which often includes Java EE, QBit, Reakt, Akka, Vert.x, Cassandra, Kafka, and cloud deployments. He has architected and implemented 100 million-users, in-memory content preference engines using Java reactive, streaming, and actor-based system as well as architected and implemented OAuth rate limiter (API gateway) for streaming music service to rate limit all backend services per partner/vendor/mobile app. Rick also contributed to the reference implementations enterprise caches as well as being a member of several spec. committees (JSR-347, JSR-107, etc.). He also is the author of the Boon JSON parser and parsing utilities which ships with Groovy.  Roman Kennke Roman Kennke is a long time free Java (and Software) activist from Freiburg, Germany. He was originally involved in GNU Classpath since 2004, later participated in opening OpenJDK and since then is a regular contributor to several parts of OpenJDK (AWT/Swing, general class library, lately Hotspot). After finishing Diploma in 2007 he was employed by aicas, who are building a hard real-time capable Java VM. During 2009 and 2010 worked for Sun Microsystems on Java Webstart. After a short interlude as a contractor for JP Morgan, he's now a Principal Software Engineer at Red Hat, where he works on OpenJDK and several related projects, including Thermostat, the Zero and Shark ports of OpenJDK, and currently on the Shenandoah GC. Rustam Mehmandarov Rustam lives and works in Oslo, Norway. He is a principal engineer, a senior consultant specializing in Java platform, and a competency network coordinator at work. He has been heavily involved in the Norwegian Java User Group – javaBin, being the leader, second-in-command, and a board member, as well as the organizer of JavaZone conference, which he is currently leading. Rustam is passionate about open source and sharing his knowledge with others. He is a frequent speaker at both national and international conferences and events. You can find Rustam on Twitter as @rmehmandarov Sander Mak Sander is a Fellow at Luminis in The Netherlands, where he crafts modular and scalable software, most often on the JVM, but with a touch of TypeScript when needed. He is the author of the O'Reilly book 'Java 9 Modularity' (see https://javamodularity.com) and an avid conference speaker. Sander loves sharing knowledge, through his blog at http://branchandbound.net, and also as a Pluralsight instructor.  Sean M. Phillips Sean M Phillips is a software engineer living near Washington D.C. USA, specializing in data analysis and visualization, currently supporting multiple deep space NASA missions. Co-authored JavaFX 9 by Example and co-founded the FXyz3D.org open source JavaFX 3D library. Vlad Mihalcea Vlad Mihalcea is a Java developer from Romania, CEO of Hypersistence, and Developer Advocate for the Hibernate project. He is passionate about enterprise systems, data access frameworks, and distributed systems. He wrote hundreds of articles about JPA, Hibernate, SQL, and database systems on [his blog](vladmihalcea.com), and he has a gold badge for the Java, JPA, and Hibernate tags on StackOverflow. He's also the author of [High-Performance Java Persistence](https://leanpub.com/high-performance-java-persistence). About Java Champions The Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Java Champions get the opportunity to provide feedback, ideas, and direction that will help Oracle grow the Java Platform. This interchange may be in the form of technical discussions and/or community-building activities with Oracle's Java Development and Developer Program teams. Members come from a broad cross-section of the Java community: Java luminaries, senior developers, architects, and consultants Academics Authors of Java-related content (online & print) and industry conference speakers Java User Group (JUG) leaders and the managers of Java-related portals You can find out more about the Java Champions by clicking here 

2017 has been a great year for new Java Champions. It has been a year of awesome activity with over 40 new Java Champions accepted into the program. Java Champions have been busy recording video...

Collections Refueled in Java 9

What’s new in the Java Collections Framework in Java 9? Java collections remain one of the most used features in Java with array lists being the most popular functionality. In Java 9, the main enhancements are the collections convenience factory methods. The factory methods make it easier to create instances of new collections.     Stuart Marks drills into these new features and explains the history, context, and usage so developers can deeply understand and fully benefit from them. So, what’s new?       There is a new family of static methods named “of”, which has been added to list, sets, map methods.  In three examples, you can see how the code is streamlined between Java 8 and 9 for list, set and map interfaces.    In Java 9, the new static factory methods return collection instances that are unmodifiable. What are the benefits of unmodifiable collections?    In the new collection instances, nulls are disallowed. In Java 9, the iteration order is randomized and will apply only to the new collection that you get from set.of and map.of. The existing collections will remain the same.             Your serialized collections like ArrayList in JDK 8 will work in JDK 9.  If you create instances of these new collections and serialize them they cannot be deserialized on JDK 8 and earlier releases.   More information about module system and JDK 9 can be found online:  JEP 269 - Convenience factory methods for collections  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations

What’s new in the Java Collections Framework in Java 9? Java collections remain one of the most used features in Java with array lists being the most popular functionality. In Java 9, the...

Java

Java Magazine: Java EE 8

By Java Magazine Editor Andrew Binstock  While the Java SE community has been focused on the release of Java 9, the Java EE community now has its turn in the spotlight. The editorial at the front of this issue (page 5) examines Oracle’s recent announcement that Java EE development is being moved to the Eclipse Foundation. The articles in this issue focus on the many technical advances in Java EE 8. For some technologies, the new release brings significant upgrades and welcome enhancements. These include Servlet 4.0’s embrace of HTTP/2 and its new server push capabilities (page 13); CDI 2.0’s improved dependency injection (page 23); and JPA 2.2’s streaming results, upgraded date conversions, and new annotations (page 43). We also examine MicroProfile, the new lightweight implementation of Java EE intended for microservices and distributed computing (page 56). If a single lightweight vehicle isn’t enough for you, we look at Java Card, a super-lightweight Java SE implementation that thrives on smart cards (page 77). It’s interesting to find out how the JVM is activated, how objects’ lifetimes are managed, and of course how security is enforced. None of this is easy or trivial in tiny environments. In addition, we have the final installment of Ben Evans’ two-part series on how the JVM executes dynamic method invocations (page 67). Throw in our book review (page 7) and the usual quiz (page 91) with its deep look into the operations of the language. 

By Java Magazine Editor Andrew Binstock  While the Java SE community has been focused on the release of Java 9, the Java EE community now has its turn in the spotlight. The editorial at the front of...

Java 9

Prepare for JDK 9

Java 9 introduces a modular system which is moving away from today’s monolithic Java SE platform. Backward compatibility is one of the main priorities and the Oracle engineering team has worked on a smooth transition to Java 9. Nonetheless, there are a number of key changes that you need to understand. Armed with the information from Alan Bateman’s presentation “Prepare for JDK 9,” and additional pointers in this blog you will avoid a lot of frustration.    Chapters  Other smaller changes in JDK 9 - 23:59  There is a new runtime version API, which can help you avoid parsing the Java version string. (24:11)  New binary structure for JRE and JDK - JEP 220 (26:35) Class loader minor changes (29:28) Multi-release JAR files - JEP 238 (32:48)  Compile for older platform versions - JEP 247 (37:09) jdeprscan, a tool to scan classes for deprecated APIs (38:26) Summary of steps to prepare for JDK 9 (39:04)  6 Steps to Prepare for JDK 9  Upgrade tools and libraries to the newest versions that support JDK 9 Decide how you can migrate your Java EE functionalities in the JDK Run jdeps to check whether your or third party code use any internal APIs   Look for “illegal reflective access” warnings, submit bugs  Audit code that parses the version string  Read the release notes In JDK 9, you can use the class path and class loading the same way you did in JDK 8. This means that you do not need to rewrite your code to move to JDK 9.  You don’t have to migrate to modules to move to JDK 9. Class path and modules can coexist and will allow you to migrate your code to modules over time. The sun.misc.Unsafe is still part of JDK 9 and works the same way as in previous releases. Update to the latest update of Java IDEs (NetBeans, Eclipse, IntelliJ…) and Maven, all of which have support for JDK 9.  Six Java EE libraries in JDK are no longer shared by default in JDK 9. Those Java EE deprecated APIs are java.corba, java.transaction, java.activation, java.xml.bind, java.xml.ws, java.xml.ws.annotation. They have been deprecated in JDK 9 and will be removed in a future release. They are disabled by default in JDK 9. Their packages will not compile in Java 9 and give an error message. The documentation gives you migration options to enable those libraries in JDK 9. This should be a temporary solution because they are scheduled to be removed in a future release.  Most internal APIs will be inaccessible by default, but some critical, widely-used internal ones will remain accessible until supported replacements exist. JEP 260, about encapsulating most internal APIs, describes which critical internal APIs will remain accessible.   You may not be aware that your applications are using JDK-internal APIs because you may depend on a third party library that uses such APIs, for example. Use Jdeps, Java dependency analysis tool, to identify those APIs. The tool also proposes suggestions for replacements when available.  Check out the Jdeps main page.  When you compile code with direct reference to internal APIs, the compilation fails. At runtime, the goal will be to encapsulate all the internal APIs in the future. There is a command line option —-illegal that allows you to debug further or deny illegal access to test future behavior. This will help you get ready for future Java releases showing you the impact of removed APIs.   Additional links to bookmark:  JEP 277: Enhanced Deprecation   JEP 260: Encapsulate Most Internal APIs   JDeps tool       Related Blogs: Prepare for JDK 9  Looking at JDK 9 with Categories 

Java 9 introduces a modular system which is moving away from today’s monolithic Java SE platform. Backward compatibility is one of the main priorities and the Oracle engineering team has worked on a...

Java 9

JDK 9 Language, Tooling and Library Features

In addition to modularity, the main new feature in JDK 9, there are other changes in the language, tools, and libraries. JDK engineer Joe Darcy gives an overview of those smaller but vital changes to the Java SE platform in his talk ‘JDK 9 language, tooling and library features”. All those improvements can be implemented outside of the module systems. They are relevant to any Java developers.  As you probably know, Java 9 still supports classpaths and your application should run on Java 9 as long as you are using APIs that are supported and intended for external use. If you have doubts, please read “Removed or Changed APIs”  Darcy explains how the Java SE backward compatibility implies compatibility for binary, source, and behavioral changes. Each platform release has a compatibility guide just as there is for Java 8.  For JDK 9 make sure to check the developer's guide on OpenJDK.  Also worth noting is the Java SE platform deprecation process with some advanced notifications in previous releases. In JDK 9, JEP 277 enhances the @Deprecated annotation providing finer-grained information to tools about the deprecation status of an API. JEP 277 details the notification process, the status and intended disposition of APIs, and lists tools to track an application’s static usage of deprecated APIs.     Now, to help you find the most relevant information for your projects, see the video chapters below:  Java 9 has new and improved tools: JShell - REPL (9:48)  Java Doc (13:46) Java Doc new features: Doclint package filtering,  updated Doclet API and a new Javadoc Search  Getting from one JDK release to another (17:15) Multi-release jar files - JEP 238   Java 9 has new Languages Changes that are not related to modules: Milling Project Coin (23:28)  Diamond with anonymous classes, take two An underscore is no longer an identifier name  Private interface methods  Deprecation and imports  Java 9 has also library updates:  New Version-String Scheme (35:53)  Process API Updates (36:33)  Strings and string concatenation (36:39) Security Libraries (38:17)  Client Libraries and FX (39:32)  Convenience factory methods for collections (40:26) More information about module system and JDK 9 can be found online:  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Crypto Roadmap  Related blog:  Two editions of Java Magazine are dedicated to Java 9. Register for free! 

In addition to modularity, the main new feature in JDK 9, there are other changes in the language, tools, and libraries. JDK engineer Joe Darcy gives an overview of those smaller but vital changes to...

Code One

2017 JavaOne Live Streaming Day 3

Welcome to day 3 of the live streaming from JavaOne. You can watch the live streaming of sessions from six rooms at JavaOne. The sessions start at 8:00am and run until 4:00pm today, leaving time for attendees to get to the CloudFest at AT&T Park tonight. I hope you have joined the conversation on Twitter using #JavaOne and followed us @javaoneconf Plenty of excellent Java SE 9 sessions again today. Sander Mak and Paul Bakker present Design for Modularity with Java 9 at 10:45am; Miro Cupak talks about Java 9 with REPL at 1:45pm; Simon Maple and Oleg Shelajev talk about The Good Cop/Bad Cop Guide to Java 9 at 4:30pm  Some highlights for Java EE 8 today, Jose Paumard and David Delabassee present JAX-RS and CDI Bike the (Reactive) Bridge at 9:00am PST; Ed Burns talks about Contemporary Java Web Applications with JSF 2.3 at 10:00am PST; and Antoine Sabot-Durand discusses CDI 2.0 in a live coding session at 12:00pm. There is a panel discussion about Accelerating the Adoption of Java EE 8 with MicroProfile at 11:45am PST.  Java SE 9 Sessions: Database Actions with Java 9 Stream Syntax Instead of SQL [HOL4286] Code Generation with Annotation Processors: State of the Art in Java 9 [CON3282] Designing for Modularity with Java 9 [CON2606] Platform Compatibility and Upgradability: The Untold Cloud Story [CON5788] Exploring Java 9 with REPL [CON3423] JUnit5: Features, Architecture, and Extensibility—Part 2 [CON4195] Building and Testing Java 9 Applications with Gradle [CON2996] The Good Cop/Bad Cop Guide to Java 9 [CON6076] Java EE 8 Sessions: JAX-RS and CDI Bike the (Reactive) Bridge [CON2549] Contemporary Java Web Applications with JSF 2.3 [CON2023] Panel: Accelerating the Adoption of Java EE 8 with MicroProfile [CON1825] Discover CDI 2.0 in Live Coding [CON6083] Java EE 8 on a Diet with Payara Micro 5 [CON3013]

Welcome to day 3 of the live streaming from JavaOne. You can watch the live streaming of sessions from six rooms at JavaOne. The sessions start at 8:00am and run until 4:00pm today, leaving time for...

Announcing 2017 Duke's Choice Award Winners

In keeping with its 15-year history, the 2017 Duke's Choice Award winners were announced at JavaOne, the world's biggest Java technology conference and gathering of Java community members. The Duke's Choice Award celebrates extreme innovation using Java technology. The primary judging criteria for this prestigious award is innovation, putting small developer shops and individual developers on equal footing with global giants. This year, in support of Java 9, there are nine winners.  Rapid Dashboard (Hakan Ozler) www.kodcu.com Lightweight Docker developer interface for Docker remote API. The Java Terminal Project (Rahman Usta) www.kodedu.com Provides the ability to run a fully featured terminal emulator on Linux, Mac, Windows. Supports Cloud and Web apps. Robo4J  (Marcus Hirt & Miroslav Wengner) robo4j.io A framework to quickly start building and running robots and IOT devices jHipster (Matt Raible) www.jhipster.tech A development platform to develop and deploy Spring Boot + Angular Web applications and Spring microservices.   On Board (Bert Ertman) www.contactonboard.com Collects real-time sensor data from marine vessels to provide captains and crew performance info.   U en Linea -Catholic University Luis Amigo (Hilmer Chona) academia.funlam.edu.co/uenlinea Heart of the University information system started in 2010, has student developer input, and runs on Oracle VM server cluster with WebLogic and Oracle DB ControlsFX (Jonathan Giles) www.controlsfx.org Library for developers of JavaFX applications with huge download stats.   Deep Space Trajectory Explorer (Sean Phillips) ai-solutions.com Created to tackle the challenges of interplanetary trajectory design.   Latin America Virtual JUG (Cesar Hernandez) www.jespanol.org Collaboration between Spanish speaking JUGs in Mexico, Colombia, Peru, Guatemala, and Panama.  Together, delivered a full day of Spanish content 8/31 Cloud Day Mexico City. Learn More   

In keeping with its 15-year history, the 2017 Duke's Choice Award winners were announced at JavaOne, the world's biggest Java technology conference and gathering of Java community members. The Duke's...

Code One

2017 JavaOne Live Streaming Day 2

Welcome to the second day of live streaming at JavaOne. Like yesterday, you can watch JavaOne sessions from six rooms at developer.oracle.com/videos. As you are watching the sessions, join the conversation on Twitter using #javaone and follow us @javaoneconf.  At 8:30am PST, watch Collections Refueled by Stuart Marks. Mark Reinhold presents Modules in One Lesson at 11:00am PST and Migrating to Modules at 1:15pm PST.  On the Java EE 8 side, there are sessions about security, JAX-RS 2.1 and CDI.  Java SE 9 Sessions:  The Diabolical Developer’s Guide to Surviving Java 9 [CON4478] Monitoring and Troubleshooting Tools Available in Your Java 9 “bin” Folder [CON4069] Java 9 on Mobile (iOS/Android) [CON3699] Collections Refueled [CON5965] Modules in One Lesson [CON6120] Fun Things to Do with Nashorn in Java 9 [CON4178] Java LangSec: New Security Enhancements in Java 9 [CON4373] Modularizing Acme Air: A Case Study in Modularizing a Java App [CON2997] Building Mobile Apps with Gluon and JavaFX [CON5808] Java 9: Search 9 TB in 0.9 Microseconds [CON4293] Tuning G1 for Real-World Applications [CON4479] Migrating to Modules [CON6122] Modules Are Coming...to Libraries?? [BOF3707] Java EE 8 Sessions:  JSR 375: New Security APIs for Java EE [CON3544] Modern Application and Microservices Security from EE 6 JASPIC to the EE 8 Security API [CON5954] What’s New in JAX-RS 2.1? [CON3625] CDI Ecosystem [BOF6113]

Welcome to the second day of live streaming at JavaOne. Like yesterday, you can watch JavaOne sessions from six rooms at developer.oracle.com/videos. As you are watching the sessions, join the...

Code One

2017 JavaOne Live Streaming Day 1

With the release of Java SE 9 and Java EE 8 a couple of weeks ago, you will be the first to get insights from the experts who built those technologies at JavaOne.    Join us at Moscone West in San Francisco or online. Watch the live-streamed sessions in the comfort of your office. Sessions and keynotes will be streamed for the next three days from October 1st to 4th. All the sessions are streamed at San Francisco local time, which is Pacific Time (PST) in the U.S. Join the conversation on Twitter using #JavaOne and follow us @javaoneconf   Today at 2:00pm, the Java Keynote will take place at Moscone North and streamed live online at developer.oracle.com/videos. You will learn about the ongoing Java technology enhancements and how you can improve and accelerate application innovation, development, and deployment.    Don’t miss Modular Development with JDK 9 by Alex Buckley at 5:00pm and Maven and Its Impact on Java 9 Projects at 11:00am. For avid Java EE users, below are the key Java EE sessions today. Note the panel discussion about the move of Java EE technologies to the Eclipse Foundation at 4:30pm.    Add the sessions to the JavaOne mobile application. If you haven’t done so already, download the application from the Apple AppStore and Google Play by searching for “JavaOne San Francisco” or “JavaOne 17”   Java SE 9 Sessions    Maven and Its Impact on Java 9 Projects [CON1374]
 Strategies for Java Application Migration to Java 9 [CON3632]
 Building a Serverless State Service for the Cloud with Java 9 [CON3920] Modular Development with JDK 9 [CON2773] 
 Modules or Microservices? [CON1450] 
 The Legacy Developer’s Guide to Java 9 [BOF5194]   Java EE 8 Sessions:    Java EE 8: Hands-on with the New Features [HOL1671] Java EE 8: What’s New in the Java EE 8 Release [CON2661] Servlet 4.0: A New Twist on an Old Favorite [CON2022] Java Keynote [KEY7692] Opening Up Java EE: Panel Discussion with Oracle, IBM, Red Hat, and the Eclipse Foundation [CON8030] JSF 2.3 in Action [BOF2723]

With the release of Java SE 9 and Java EE 8 a couple of weeks ago, you will be the first to get insights from the experts who built those technologies at JavaOne.    Join us at Moscone West in San...

Java 9

Java 9 Release Now Available!

The Java 9 release introduces more than 150 new features including the module system, which enables developers to scale down the Java SE platform for small devices, improves performance and security, and makes it easier to construct and maintain libraries and large applications.  Java 9 is a major feature release of the Java platform and the result of an industry-wide development effort involving open review, weekly builds, and extensive collaboration between Oracle engineers and members of the worldwide Java developer community via the OpenJDK Community and the JCP.                                     Check out the JDK 9 release and the release notes:  JDK 9 release  Release notes   Watch Java 9 expert insights, as they explain key features of this release:  Small Language Changes in Java Development Kit 9 by Joe Darcy Modules in Java Development Kit 9 by Alex Buckley Introducing JShell by Robert Field  A (Re)introduction to the G1 Garbage Collector by Paul Su  Java in a World of Containers by Paul Sandoz Collections Framework Enhancements in Java Development Kit 9 by Stuart Marks Changes to the Java Development Kit Release Model by Aurelio Garcia-Ribeyro There will be a change in the pace of the Java releases.  “After Java 9 we will adopt a strict, time-based model with a new feature release every six months, update releases every quarter, and a long-term support release every three years” explains Mark Reinhold chief architect on the Java Platform. Read more  To better understand the new Java 9 features, how to migrate your applications, and much more, check out the following resources:  JDK 9 Documentation  What’s new in Java 9   Migration Guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Deprecated API  Security Guide  Two editions of Java Magazine are dedicated to Java 9. Register for free! 

The Java 9 release introduces more than 150 new features including the module system, which enables developers to scale down the Java SE platform for small devices, improves performance and security,...

General

About Java EE 8, JAX-RS, JSON API, and Mobile Apps

With the Java EE 8 release coming out soon, now is the best time to get up to speed with important APIs. Learn about key Java EE 8 APIs and how to connect your mobile applications to a Java EE backend with three presentations.  Reactive REST Clients in a Microservices Landscape with David Delabassee. When designing microservices exchanges, REST is clearly the most popular approach, i.e. the de-facto standard. JAX-RS API hides all the low-level details behind RESTful calls. Complexity really starts to arise when multiple remote services need to be consumed in highly efficient manner. During this technical session, we will cover in details different solutions and best practices to efficiently consume REST services. This includes:  - Synchronous Vs. Asynchronous - Jersey Reactive Client API - Popular Reactive libraries (e.g. RxJava) - JAX-RS 2.1 Client API How to use the new JSON Binding API with Dmitry Kornilov. JSON support is an important part of Java EE. This session provides a deep dive into JSON-P and JSON-B APIs explains how they are connected and can be used together. We will introduce and demonstrate new JSON-P features such as JSON Patch, JSON Pointer, and JSON Merge Patch as well as JSON-B features such as default and customized mapping, adapters, and serializers. Enterprise Functionality for Mobile Apps with Johan Vos Today an increasing number of companies and organizations are facing demands from their users (customers, partners, employees, and end-users) to make their enterprise functionality available via mobile apps. While many concepts that are used on the web also apply to mobile apps, the users of those apps typically expect more than just a website. In this session, we will demonstrate how you can reuse your existing investments in enterprise code and infrastructure, and easily add a mobile channel. We will demonstrate how the Oracle Cloud provides a great platform for bridging the gap between your enterprise code and the mobile apps your users are asking for.

With the Java EE 8 release coming out soon, now is the best time to get up to speed with important APIs. Learn about key Java EE 8 APIs and how to connect your mobile applications to a Java EE backend...

Inside the Emerging Languages Track at JavaOne

New app development languages are coming out fast. As improvements continue in the Java Development Kit (JDK), developers can have new levels of productivity with the Java Virtual Machine (JVM). The JVM supports both dynamically typed languages, which focus on application customization, and statically typed general-purpose languages, which focus on application development. Through this track, you’ll learn more about some of the most used languages that can harness the power of JVM. Some languages covered in this track include Ceylon, Clojure, Groovy, JavaScript, JRuby, Kotlin, and Scala. In JDK 9, the Nashorn feature is better and brighter than before. If you use JavaScript, you'll want to take advantage of Nashorn to use the Java stack and still have the opportunity to use your favorite language. If you use Java, you want to work with JavaScript during dynamic coding situations, like configuration management and query composition. Combine the power of JavaScript and Java together at “Nashorn: What’s New in JDK 9” and learn about new features of JDK 9 and the Nashorn platform. Another similar session that covers Nashorn is “Fun Things to Do with Nashorn in Java 9.” This session specifically focuses on Nashorn’s new upgrades, and how you can put these to use.   As a Java developer, you must know many different languages in order to be successful. From implementing software in Java and Kotlin, to constructing build pipelines with a Groovy DSL or JSON, the languages used with Java are endless! In this code-intense, polyglot session explore the modern era of software development. Go to “Polyglot Adventures for the Modern Java Developer” at JavaOne for more fun. Explore Eve at JavaOne, a programming language that decreases the complication of software development by treating everything as a record you read and write. With interesting design choices, the entire Eve platform is reactive and transparent for introspection. Eve gives an alternative solution for the typical use cases in software development. Learn more about Eve at “If Everything Were a Database.” With more sessions from other Java filled tracks, the possibilities to learn at JavaOne are endless! If you haven’t registered yet, it’s not too late to sign up. Register now for JavaOne and save $200 off the onsite price until September 29th. 

New app development languages are coming out fast. As improvements continue in the Java Development Kit (JDK), developers can have new levels of productivity with the Java Virtual Machine (JVM). The...

General

Java EE and Docker Tips

Instead of parsing a ton of documentation to find common CLI commands, try this. Java Engineer and Architect Manfred Riem wrote a series of blog about tips that will help you with your day-to-day programming.  One of his series is about Docker, a popular platform to build and run distributed applications across different infrastructures. His 17 tips include a lot of command lines to manage and delete containers, as well as create, inspect, and customize imagine and much more. Bookmark the tips  Another series is on Java EE. He shares tips about Maven, REST file storage, and a minimal Git server web application, for example. Here is a full list of his Java EE tips  For questions and comments about his tips, reach out to Manfred on Twitter at @mnriem or email to blog (at) manorrock.com p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Times; color: #042eee; -webkit-text-stroke: #042eee} li.li2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Times; color: #0326cc; -webkit-text-stroke: #0326cc} span.s1 {font-kerning: none} span.s2 {-webkit-text-stroke: 0px #042eee} span.s3 {text-decoration: underline ; font-kerning: none; -webkit-text-stroke: 0px #0326cc} span.s4 {-webkit-text-stroke: 0px #000000} ul.ul1 {list-style-type: disc} A collection of Docker tips. Docker Tip #17 - Turn off swapping (October 12, 2016) Docker Tip #16 - Making sure your process receives signals (October 11, 2016) Docker Tip #15 - Create a Tomcat image (October 4, 2016) Docker Tip #14 - Set the maximum number of open files (September 16, 2016) Docker Tip #13 - Use NetBeans 8.2 when editing your Dockerfile (September 15, 2016) Docker Tip #12 - Use docker commit to customize your image (September 12, 2016) Docker Tip #11 - Speed up Docker image creation (September 8, 2016) Docker Tip #10 - Inspect the history of a Docker image (September 6, 2016) Docker Tip #9 - Push image into private Docker registry (September 2, 2016) Docker Tip #8 - Create a Jenkins slave image (September 1, 2016) Docker Tip #7 - Create a base Java image (August 31, 2016) Docker Tip #6 - Create a base Alpine GlibC image (August 30, 2016) Docker Tip #5 - Prune all images (August 26, 2016) Docker Tip #4 - Scrub dangling containers (August 24, 2016) Docker Tip #3 - Kill and remove all containers (August 23, 2016) Docker Tip #2 - Remove all containers (August 22, 2016) Docker Tip #1 - Kill all your containers (August 21, 2016) p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Times; color: #042eee; -webkit-text-stroke: #042eee} li.li2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Times; color: #0326cc; -webkit-text-stroke: #0326cc} span.s1 {font-kerning: none} span.s2 {-webkit-text-stroke: 0px #042eee} span.s3 {text-decoration: underline ; font-kerning: none; -webkit-text-stroke: 0px #0326cc} span.s4 {-webkit-text-stroke: 0px #000000} ul.ul1 {list-style-type: disc} A collection of JavaEE tips. JavaEE Tip #10 - A minimal issue tracker (January 1, 2017) JavaEE Tip #9 - A minimal Git server web application (October 14, 2016) JavaEE Tip #8 - A minimal Maven repository manager (October 10, 2016) JavaEE Tip #7 - A simple REST file store (October 7, 2016) JavaEE Tip #6 - Resources (December 18, 2014) JavaEE Tip #5 - Resource (December 15, 2014) JavaEE Tip #4 - PreDestroy (December 13, 2014) JavaEE Tip #3 - PostConstruct (December 12, 2014) JavaEE Tip #2 - Location of the JavaEE tutorial (November 6, 2014) JavaEE Tip #1 - Location of the JavaEE API documentation (November 5, 2014)  

Instead of parsing a ton of documentation to find common CLI commands, try this. Java Engineer and Architect Manfred Riem wrote a series of blog about tips that will help you with your...

Code One

Previewing the “Core Java Platform” Track at JavaOne

Are you curious about what you can learn at JavaOne? In the “Core Java Platform” track, JavaOne users will explore aspects that are key to using the Java platform. Java’s successful advancement comes from the foundation of the Java technologies. Attendees will learn about new advancements in Java Virtual Machines and explore technical explanations of the latest library features. Security-related topics about Java will also be addressed, including security tools and coding techniques. Interested in getting all your questions answered? Attend one of the “Ask” sessions that are part of the "Core Java Platform" track. Learn more about JDK and OpenJ9 from the Java architects themselves in these open Q&A sessions. Good code, bad code, you’ve seen it all. In this session, you’ll learn about the familiar antipatterns that you continually see. Recognizing these code smells and avoiding them will allow you to create even better code! Check out this introductory session (“Twelve Ways To Make Code Suck Less”) for more. Troubleshooting and supervising mechanisms allow for the creation of dependable applications with a strong performance. Combined with an array of diagnostic and troubleshooting mechanisms, the JDK is extremely helpful when figuring out problems in our Java applications. With new updates to the tools in the “bin” folder in Java 9, it’s important to understand what is being added and discontinued to these tools. Learn more about these key monitoring and troubleshooting tools at “Monitoring and Troubleshooting Tools Available in Your Java 9 'bin' Folder." You all have had moments when your Java application crashes. But what happens when you don’t know the reason why it crashed? In this Advanced session, you’ll explore the details stored by the HotSpot crash handler in the corresponding error files. You’ll learn how this information can be utilized to analyze and reproduce the crash. Come to the “Analyzing HotSpot Crashes” session at JavaOne to easily detect, classify, and take care of problems that come up with your Java HotSpot VM. Haven’t signed up for JavaOne yet? Don’t worry, the Early Bird Discount has been extended until August 5th! There is still time to save $400 off the onsite price. Register today and save big! 

Are you curious about what you can learn at JavaOne? In the “Core Java Platform” track, JavaOne users will explore aspects that are key to using the Java platform. Java’s successful advancement comes...

Code One

Previewing the "Core Java Platform" Track at JavaOne

Are you curious about what you can learn at JavaOne? In the “Core Java Platform” track, JavaOne users will explore aspects that are key to using the Java platform. Java’s successful advancement comes from the foundation of the Java technologies. Attendees will learn about new advancements in Java Virtual Machines and explore technical explanations of the latest library features. Security-related topics about Java will also be addressed, including security tools and coding techniques. Interested in getting all your questions answered? Attend one of the “Ask” sessions that are part of the "Core Java Platform" track. Learn more about JDK and OpenJ9 from the Java architects themselves in these open Q&A sessions. Good code, bad code, you’ve seen it all. In this session, you’ll learn about the familiar antipatterns that you continually see. Recognizing these code smells and avoiding them will allow you to create even better code! Check out this introductory session (“Twelve Ways To Make Code Suck Less”) for more. Troubleshooting and supervising mechanisms allow for the creation of dependable applications with a strong performance. Combined with an array of diagnostic and troubleshooting mechanisms, the JDK is extremely helpful when figuring out problems in our Java applications. With new updates to the tools in the “bin” folder in Java 9, it’s important to understand what is being added and discontinued to these tools. Learn more about these key monitoring and troubleshooting tools at “Monitoring and Troubleshooting Tools Available in Your Java 9 'bin' Folder." You all have had moments when your Java application crashes. But what happens when you don’t know the reason why it crashed? In this Advanced session, you’ll explore the details stored by the HotSpot crash handler in the corresponding error files. You’ll learn how this information can be utilized to analyze and reproduce the crash. Come to the “Analyzing HotSpot Crashes” session at JavaOne to easily detect, classify, and take care of problems that come up with your Java HotSpot VM. Haven’t signed up for JavaOne yet? Don’t worry, the Early Bird Discount has been extended until August 5th! There is still time to save $400 off the onsite price. Register today and save big! 

Are you curious about what you can learn at JavaOne? In the “Core Java Platform” track, JavaOne users will explore aspects that are key to using the Java platform. Java’s successful advancement comes...

Code One

Special Perks of Attending JavaOne 2017

Signing up for JavaOne gives you access to a conference not only filled with learning, but also fun! You will have access to JavaOne sessions, hands-on labs, tutorials, Birds-of-a-Feather (BOF) sessions, and Developer Community Day. Another fan favorite is the Java Exhibit Hall, which will feature companies, freebies, and live interviews. Don’t forget to head over to this special part of your JavaOne experience. Meals are covered in your full conference benefits from Monday through Thursday. Your transportation needs are also taken care of with rides to and from the Moscone Center. Don’t forget about the JavaOne attendee backpack! This year, we have a brand new backpack that you won’t want to miss out on. The JavaOne Community Keynote always pleases, and we can assure you it will be just as good as last year. You’ll have to come to see what the surprise theme will be this year. Learn from JavaOne keynotes during the day, and party it up with us at JavaOne parties at night! The Welcome Reception and Appreciation events will be featured at this year’s conference again. Take advantage of our Early Bird Registration, which ends in three days, on Saturday, July 22nd. The full conference rate will increase by $400, and the government rate will increase by $600. Although there are no early bird discounts attached to it, there is also the group passes rate for registration. You can save 20-28% off the current pass when purchasing 5+ passes. Sign up now to receive the best deal on your JavaOne experience!

Signing up for JavaOne gives you access to a conference not only filled with learning, but also fun! You will have access to JavaOne sessions, hands-on labs, tutorials, Birds-of-a-Feather (BOF)...

Code One

Special Perks of Attending JavaOne 2017

Signing up for JavaOne gives you access to a conference not only filled with learning, but also fun! You will have access to JavaOne sessions, hands-on labs, tutorials, Birds-of-a-Feather (BOF) sessions, and Developer Community Day. Another fan favorite is the Java Exhibit Hall, which will feature companies, freebies, and live interviews. Don’t forget to head over to this special part of your JavaOne experience. Meals are covered in your full conference benefits from Monday through Thursday. Your transportation needs are also taken care of with rides to and from the Moscone Center. Don’t forget about the JavaOne attendee backpack! This year, we have a brand new backpack that you won’t want to miss out on. The JavaOne Community Keynote always pleases, and we can assure you it will be just as good as last year. You’ll have to come to see what the surprise theme will be this year. Learn from JavaOne keynotes during the day, and party it up with us at JavaOne parties at night! The Welcome Reception and Appreciation events will be featured at this year’s conference again. Take advantage of our Early Bird Registration, which ends in three days, on Saturday, July 22nd. The full conference rate will increase by $400, and the government rate will increase by $600. Although there are no early bird discounts attached to it, there is also the group passes rate for registration. You can save 20-28% off the current pass when purchasing 5+ passes. Sign up now to receive the best deal on your JavaOne experience!

Signing up for JavaOne gives you access to a conference not only filled with learning, but also fun! You will have access to JavaOne sessions, hands-on labs, tutorials, Birds-of-a-Feather (BOF)...

Java 9

Looking at JDK 9 with Categories

To help you navigate the new changes in JDK 9, the new functionalities can be organized into six categories.  Those categories will help you understand which features are new, which require you to change your code or process, which come as default with JDK 9, which are improved APIs and which will be removed. The new features are available in JDK 9 early access. You can download and test today the features in JDK 9 early access  The categories are more clearly defined as:  Behind the scenes: functionalities that you get as default in JDK 9. You don’t need to change your code or use new tools. It will just work with JDK 9.  New functionality: new capabilities that you have to change your code or use new tools to get  Specialized: new features that will require you to make changes. Those APIs are only for very advanced use-cases.   New standards: JDK 9 will take advantage of new standards in the industry.    Housekeeping: improvements to existing libraries, changes in internal code,  work for future improvements Gone: features available today in JDK 8, but that will not be available in JDK 9.  The full list of features is available on the JDK 9 website. I am listing below some libraries that you, as a developer, might want to learn more about. See the graph at the bottom of the page.  Behind the scene 225: Javadoc Search 254: Compact Strings 265: Marlin Graphics Renderer New Standards  110: HTTP 2 Client 224: HTML5 Javadoc 263: HiDPI Graphics on Windows and Linux New Functionality 200: The Modular JDK 201: Modular Source Code 222: jshell: The Java Shell (Read-Eval-Print Loop) 277: Enhanced Deprecation 282: jlink: The Java Linker Housekeeping  223: New Version-String Scheme 248: Make G1 the Default Garbage Collector 289: Deprecate the Applet API 253: Prepare JavaFX UI Controls & CSS APIs for Modularization Specialized   285: Spin-Wait Hints New Standards  287: SHA-3 Hash Algorithms 101: HTTP 2 Client 

To help you navigate the new changes in JDK 9, the new functionalities can be organized into six categories.  Those categories will help you understand which features are new, which require you to...

Java 9

Get Ready for Java 9

Java 9 introduces a modular system which is moving away from today’s monolith Java SE platform. Backward compatibility is one of the main priorities and the Oracle engineering team has worked on a smooth transition to Java 9. Nonetheless, there are a number of key changes below that you need to understand. Knowing this information will also help you better prepare for the release of Java 9.    The general compatibility policies indicate that supported APIs can be removed with advanced notice. JEP 277 on enhanced deprecation describes the notification process, the status and intended disposition of APIs, as well as tools to analyze an application’s static usage of deprecated APIs.    JEP 260, about encapsulating most internal APIs, explains that most internal APIs will be inaccessible by default, but leaves a few critical, widely-used internal APIs accessible, until supported replacements exist for all or most of their functionality. As a general rule, you should not use unsupported APIs, which are mostly sun.* APIs like sun.misc.Unsafe. Those APIs are meant to be used by Oracle JDK team. Mark Reinhold did an entire talk on sun.misc.Unsafe The following critical internal APIs proposed to remain accessible in JDK 9 are: sun.misc.{Signal,SignalHandler} sun.misc.Unsafe (The functionality of many of the methods in this class is now available via variable handles (JEP 193).) sun.reflect.Reflection::getCallerClass(int) (The functionality of this method may be provided in a standard form via JEP 259.) sun.reflect.ReflectionFactory.newConstructorForSerialization The above critical internal APIs will be placed in, and their packages exported from, a JDK-specific module named jdk.unsupported. You will find more details on the JEP 260 page.  How do you know whether your program uses or depends on any JDK-internal API? You could identify those APIs from the name of the packages in the source code if you have access to the source code. Sometimes this is a challenge because you might use a third party library that depends on one of those APIs. To identify those APIs, you can use Jdeps, Java dependency analysis tool, which was introduced in JDK 8. You should use the improved version of Jdeps, available in JDK 9 early access releases. There is also a plug-in for Maven.        The jdeps command shows the package-level or class-level dependencies of Java class files. The input class can be a path name to a .class file, a directory, a JAR file, or it can be a fully qualified class name to analyze all class files.  By default, it analyzes all classes specified in the -classpath option and in input files. You will need to use ‘-jdkinternals’ to  flag the internal APIs. More information is available on the Jdeps main page. The tool notifies you of the JDK internal APIs to modify as well as suggesting replacements when available. A full list of JDK internal API replacements is available here    More information about module system and JDK 9 can be found online:  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Related blog: Modular Development with JDK 9  Two editions of Java Magazine are dedicated to Java 9. Register for free!   

Java 9 introduces a modular system which is moving away from today’s monolith Java SE platform. Backward compatibility is one of the main priorities and the Oracle engineering team has worked on...

Java 9

Collections Refueled

Java collections is one of the most used frameworks in Java with array lists being the most popular functionality. In his presentation, Stuart Marks dives into the new features of collections in Java 8, as well as what’s coming in Java 9. For those of you who don't know Stuart, he works on JDK core libraries at Oracle.  Most developers have moved to JDK 8 by now, and Stuart describes the new JDK 8 features that you might have overlooked.  One of those new features is the introduction of a set of default methods to the collection interfaces. Default methods enable you to add methods to existing interfaces without breaking compatibility; e.g., converting a collection into a stream.  Stuart goes over some improvements to Iterable, Collection and List:  Iterable  Collection  List  The collection interfaces with the newest methods are Map and Comparator. Stuart drills down and gives you examples:  Map Interface Comparator In Java 9 improvements to the collections framework include factory methods for collections, which introduce methods that make it easy to create collections. JEP 269 - Convenience factory methods for collections  API design: Handling arbitrary number of mappings   Design and implementation issues,  which includes immutability, iteration order, nulls disallowed, duplicate handling, space efficiency and serializability  You can learn more about the JEPs in Java 9 on the OpenJDK website. Here is a direct link to the aforementioned JEP 269 - Convenience factory methods for collections Check out the changes to Java 9 in the OpenJDK community. Try out the JDK 9 early access build at http://jdk.java.net/9/ and provide feedback on the early access forum  JDK 9 documentation early access is available here. Another must-read is the new AdoptOpenJDK community GitHub website with articles, use cases and much more.   More information about module system and JDK 9 can be found online:  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Related blog: Modular Development with JDK 9  Two editions of Java Magazine are dedicated to Java 9. Register for free! 

Java collections is one of the most used frameworks in Java with array lists being the most popular functionality. In his presentation, Stuart Marks dives into the new features of collections in Java...

General

Massive Open Online Course: Java Microservices

Learn to create RESTful Java microservices using Spring Boot and deploy them to the Cloud.   In this new Java microservices massive open online course (MOOC), you will create your own microservices using Spring Boot. With Spring Boot, you will be able to develop a stand-alone, production grade application, in easy to deploy JAR or WAR formats. Microservices are a compilation of independently deployable, small and modular application services. Each microservice has defined input and output exposed through RESTful endpoints. As a result, you can scale, replace and link to other services, such as caching, without any architectural changes. This 3-week course covers: Introduction to REST and Microservices Building a RESTful Java Application with Spring Boot Automating Build and Deploy with Developer Cloud Services  The MOOC format: Available to anyone at no charge.  Self-paced online course with videos available 24/7. No evening calls or travel needed.  Discussions with other students and teacher via the forum.  Each week, one or more lessons will be available, including video materials, homework and a quiz. After the 3 weeks  Complete the three course quizzes and score at 70% or higher to receive a completion award. The quiz questions are based on the course materials and homework.  The course will start July 17th, 2017. Space is limited. Register now  Related Content: Spring Boot and Java Demo  

Learn to create RESTful Java microservices using Spring Boot and deploy them to the Cloud.   In this new Java microservices massive open online course (MOOC), you will create your own microservices...

Java

Java Magazine Edition about Libraries

By Guest Blogger Andrew Binstock  In an age of frameworks, there still remains a supreme need for libraries, those useful collections of classes and methods that save us a huge amount of work. For all the words spilled on the reusability of object orientation (OO), it’s clear that code reuse has been consistently successful only at the library level. It’s hard to say whether that’s a failure of the promises of OO or whether those promises were unlikely to ever deliver the hoped-for reusability.  In Stephen Colebourne’s article (page 28), he gives best practices for writing libraries of your own. Colebourne is the author of the celebrated Joda-Time library, which was the standard non-JDK time and date library prior to Java SE 8. In the article, he gives best practices for architecting the library and shares guidelines he has learned along the way that sometimes fly in the face of generally accepted programming precepts. Writing your own library? Then start here.  We also examine three well-designed libraries that provide useful functionality but might not be widely known. The first of these is Project Lombok (page 10), which uses annotations to greatly reduce the writing of boilerplate code—leading to fewer keystrokes and much more readable code. Andrés Almiray’s article on the JDeferred library (page 16) is a deep dive into the concepts of futures and promises, which are techniques for defining, invoking, and getting results from asynchronous operations. The built-in Java classes for futures and promises work well but can be difficult to program. JDeferred removes the difficulty and, like Lombok, leads to considerably cleaner code.  Finally, we revisit an article we ran a year ago on jsoup (page 22), which is one of the finest ways of handling HTML: parsing, scraping, manipulating, and even generating it.  If libraries are not your favorite topic, we have you covered with a detailed discussion (page 34) of how to use streaming syntax rather than SQL when accessing databases. In addition, we offer our usual quiz (this time with the inclusion of questions from the entry-level exam), our calendar of events, and other goodness. (Note that our next issue will be a jumbo special issue on Java 9.) 

By Guest Blogger Andrew Binstock  In an age of frameworks, there still remains a supreme need for libraries, those useful collections of classes and methods that save us a huge amount of work. For all...

General

What's Cool in Java 8, and New in Java 9

  Which features in Java 8 and 9 should you look at first? Aurelio Garcia-Ribeyro, director of product management on the Java platform explains the most popular features of Java 8 and 9  Java 9 has over 90 Java enhancement proposals (JEPs)]. To help you navigate those JEPs, Aurelio classified the JEPs in 5 categories, which are: behind the scenes, new functionality, new standards, housekeeping and gone. In this presentation, he describes some of the most important JEPs in each category.   Behind the scenes: functionalities that you get as default in JDK 9. They will be compatible with your current code and tools and you will get better performance  250: Store Interned Strings in CDS Archives 254: Compact Strings  225: Javadoc Search   New functionality: new capabilities that you have to change your code or use new tools to get.  Project Jigsaw: Module system for the Java platform  282: jlink, the Java Linker  277: Enhanced deprecation  269: Convenience Factory Methods for Collections  222: Shell, a read-eval-print loop (REPL)  238: Multi-release JAR Files  New standards: JDK 9 will take advantage of new standards in the industry.  267: Unicode 8.0  226: UTF-8 Property resource bundles  249: OCSP Stapling for TLS  287: SHA-3 Hash algorithms  110: HTTP 2/Client  Housekeeping: improvements to existing libraries, changes in internal code,  work for future improvements. 260: Encapsulate most internal APIs 275: Modular Java application packaging  223: New version-string scheme  295: Ahead of time compilation  280: Indify string concatenation  271: Unified GC Logging  248: Make G1 the default Garbage Collector  213: Milling Project Coin  290: Filter incoming serialization data  214: Remove GC combinations   You can test any of those functionalities by trying the JDK 9 early access The full list of JEPs is available as part of the OpenJDK JDK 9  For JDK 8, Aurelio gives an example demonstrating how to use lambdas in Java 8 and pass not just data but behavior. He also explains the default and reference methods. For example, when you define a collection interface you can pass a default method. This will ensure compatibility with code written for older versions of your interfaces and add new functionality to your interfaces.  Chapters for Java 8 features  Lambda Expressions - 2m29s  Default Methods and Method References - 10m04s  Date and Time API - JSR 310    More information about module system and JDK 9 can be found online:  JEP 261: Module System  JEP 200: The Modular JDK  JDK 9 release  Release notes   Java 9 expert insights JDK 9 documentation  Migration guide Java SE & JDK 9 API Specification Oracle JDK 9 and JRE 9 Certified System Configurations Related blog: Modular Development with JDK 9  Two editions of Java Magazine are dedicated to Java 9. Register for free! 

  Which features in Java 8 and 9 should you look at first? Aurelio Garcia-Ribeyro, director of product management on the Java platform explains the most popular features of Java 8 and 9  Java 9 has over...

Java Coding and Concepts MOOC

We are pleased to announce that enrollment is open for our newest Oracle Massive Open Online Course (MOOC): Java Coding and Concepts. The course starts April 27th! Enrollment is free! Do work with code periodically, but program by hacking other people's code? Are you new to programming and want to develop a deep understanding of key Java programming concepts without falling asleep in class? Would you like to see how Oracle cloud technology can accommodate the development needs of a project? If so, you may find this MOOC very helpful! This is our first MOOC designed for a foundations-level audience. It employs a game-based learning methodology to build your understanding and prepares you to think through coding problems far better than traditional lecturing. You'll learn key Java programming concepts, go behind the scenes to understand development practices, and apply your knowledege to coding labs. This course starts April 27th, and is short - just 4 weeks. But you will learn a lot, including: Object Oriented Thinking and Class Design Static vs Instance Variables Inheritance Lambda Expressions So click the Enroll button - read the full description of the course and watch the video - and we'll see you on April 27th!  

We are pleased to announce that enrollment is open for our newest Oracle Massive Open Online Course (MOOC): Java Coding and Concepts. The course starts April 27th! Enrollment is free! Do work with code...

Java Champions

New Java Champions: Holly Cummins, Aleksey Shipilev, and David Heffelfinger

Welcome three new Java Champions: Holly Cummins, Aleksey Shipilev, and David Heffelfinger Holly Cummins has been a Java engineer since 2001. She was one of the core engineers on the IBM J9 JVM working on Garbage Collection (GC) and Just in Time (JIT) compilation. She is currently a technical lead for IBM BlueMix Garage.    Holly is also a committer and PMC member on the Apache Aries project, which melds the OSGi and Java EE programming models. She created several wearable projects connected to a backend server to demonstrate the low power requirements of modern application servers, and the suitability of Java for embedded application servers. Holly is the co-author of Enterprise OSGi in Action (Manning). She has published on a range of subjects, from performance myths, garbage collection tuning principles, enterprise OSGi, Java on Raspberry PIs, microservices, automation, and the importance of fun in a development culture. She is a frequent speaker at conferences including Devoxx and JavaOne. Follow her on Twitter @holly_cummins Aleksey Shipilev is a principal software engineer at Redhat. He is the author of the Java Microbenchmarking Harness (JMH), a project to examine the performance of Java coding constructs.  Prior to JMH, programmers wrote their benchmarking harnesses fraught with errors.  He wrote JCStress, a toolkit for testing concurrency code. He also developed a Java-Object-Layout, JOL, which uses Unsafe, JVMTI, and Serviceability Agent (SA) heavily to decode the actual object layout, footprint, and references.  Aleksey is now a committer to the new GC project Shenandoah. He is very active on mailing lists like Java Concurrency Interest, JMH, and OpenJDK projects. Follow him on Twitter @shipilev David Heffelfinger is an independent consultant based in the Washington, DC area. He is a member of the NetBeans Dream Team and is part of the JavaOne content committee.  David has written 7 books on Java EE, application servers, NetBeans, JasperReports, and Wicket. His titles include Java EE 7 Development with NetBeans 8, Java EE 7 with GlassFish 4 Application Server, and JasperReports 3.5 For Java Developers.  David has been speaking at JavaOne every year since 2012. He is a frequent speaker at NetBeans Day in San Francisco, showcasing NetBeans features that greatly enhance the development of Java EE applications. Follow him on Twitter @ensode The Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Learn more about Java Champions  p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; -webkit-text-stroke: #000000} span.s1 {font-kerning: none} p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Arial; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

Welcome three new Java Champions: Holly Cummins, Aleksey Shipilev, and David Heffelfinger Holly Cummins has been a Java engineer since 2001. She was one of the core engineers on the IBM J9 JVM working...

General

New Java Magazine Edition about UI Tools

From Chief Editor of Java Magazine Andrew Binstock Coding UIs used to be an awful chore, with endless minute adjustments having to be constantly recorded. Fortunately, JavaFX greatly facilitated UI construction by scripting it with FXML, which is discussed in our first article. Our second article explores the drag-and-drop design tool, Scene Builder, which can generate FXML. Scene Builder was originally an Oracle tool that was released to open source and taken over by Gluon, which has been maintaining it ever since. Front ends to web applications have their own unique needs, and we cover those too in a pair of articles: one on MVC 1.0, a web framework that at one time was considered for inclusion in Java EE 8, and another on a JavaScript toolkit, Oracle JET, which provides among many resources a large palette of useful controls with easy ways to wire them together. If UIs are not your favorite topic, we have other subjects of interest: a detailed discussion of using MQTT, one the main messaging protocols in IoT. You'll also find an interesting dive into how the up-and-coming build tool Gradle uses libraries. And finally, we revisit a topic we've covered before: Compact Profiles in Java 8. In addition, of course, we offer our usual quiz —this time with the inclusion of questions from the entry-level exam—our review, and other goodness, such as readers' views on whether to include JavaScript in future issues.  Previous edition was about Java and JVM tools 

From Chief Editor of Java Magazine Andrew Binstock Coding UIs used to be an awful chore, with endless minute adjustments having to be constantly recorded. Fortunately, JavaFX greatly facilitated UI...

General

Introduction to Modular Development

What is the new module system in Java 9? In Java 7, the JDK was a complex monolithic platform. With Java 9, the platform itself needs to be modular to introduce the new system. Alan Bateman explains the underlining organization of the module system. He shows how modules are linked to each other within an application and how to create runtime images with the jlink tool, for example.  The JDK 9 will work with your application the same as JDK 8 did. To make sure your code will run, you need to understand the deprecation process, encapsulation, and how to check your applications for unsupported APIs. Read all about it in the blog “Gear up for Java 9.” You will still be able to use the class path with Java 9. Alan shows how to use the module and class paths together in the video below. He walks you through an example of an application with several modules. He also dives into modules themselves and explains their nomenclature, packages with many resources, configuration, and commands, to name a few.     I recommend watching the entire video. To help you go back to this content, I listed the topics addressed in this video:   Part 1: Modular development starts with a modular platform  Java Linker (10:02)  Part 2: Introduction to modules (13:53) An example with multiple modules (15:38) Commands for compiling modules, How to compile and package modules (25:13)  Using the module path and classpath together (35:45)  Linking - a runtime image (38:39)  Related to the module system: JEP 261: Module System  JEP 201: Modular source code  JEP 200: The modular JDK  JEP 220: Modular run-time images  JEP 282: The Java Linker (jlink)  JEP 260: Encapsulate Most Internal APIs  OpenJDK Jigsaw Project  Related blogs  Gear up for Java 9 Prepare for JDK 9  Looking at JDK 9 with Categories

What is the new module system in Java 9? In Java 7, the JDK was a complex monolithic platform. With Java 9, the platform itself needs to be modular to introduce the new system. Alan Bateman explains...

Java

New Java Champions: Emmanuel Bernard, Chris Newland and Bert Jan Schrijver

Welcome three new Java Champions: Emmanuel Bernard, Chris Newland and Bert Jan Schrijver   Emmanuel Bernard is a data platform architect at JBoss. He has been a contributor and lead of open source projects for over 15 years and has led the Hibernate portfolio since 2008. He also contributed to JPA specs as JCP EG member and the Bean Validation spec as JSR Spec Lead.  He is the author of Hibernate Search in Action, a reference guide for Hibernate Search. Aside from speaking at Java conferences around the world, he runs two podcasts, JBoss Community Asylum, and the French podcast, “Les Cast Codeurs”. Chris Newland is a senior developer and team lead at ADVFN using Java to process stock market data feeds in real time. In his spare time, he invented and still leads developers on the JITWatch project, an open source log analyzer to visualize and inspect Just-In-Time compilation decisions made by the HotSpot JVM. Chris is also a JavaFX developer and built a performance benchmark called DemoFX.  He set up a community OpenJFX backend at http://chriswhocodes.com/ for cross-platform builds so that OpenJFX can be used with ARM JDKs and OpenJDK-based builds from other vendors such as Azul Systems' Zulu JDK.   Bert Jan Schrijver is a senior developer at JPoint. A tireless community organizer, he organizes J-Fall, the biggest Java conference in the Netherlands as well as the IoT Tech Days, a one-day conference on smart technologies. He is the chief editor of Java Magazine in the Netherlands, which has 4,000 subscribers.   Bert Jan worked with the JCP to have NLJUG join the Adopt-a-JSR program. The NLJUG was nominated as ‘outstanding adopt-a-jar participant’ for the JCP awards this year. Just in the past year, Bert Jan helped the Utrecht and Amsterdam JUGs start up their user groups. Bert Jan is always eager to share experiences with other JUG leaders and he helps out at Devoxx4Kids workshop to teach kids how to code.  The Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Learn more about Java Champions  p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Calibri; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

Welcome three new Java Champions: Emmanuel Bernard, Chris Newland and Bert Jan Schrijver   Emmanuel Bernard is a data platform architect at JBoss. He has been a contributor and lead of open source...

General

Integrating the Ethereum Blockchain into Java Apps

How to access a distributed ledger technology blockchain from a Java application using web3j. The Ethereum blockchain is a decentralized platform that is the backbone of a secure, decentralized internet and is driven by the eponymous cryptocurrency Ether. Conor Svensson authored web3j, a lightweight Java library for building Java applications on the Ethereum blockchain.  In a first article, which appeared in the Java Magazine, Conor Svensson gives the background of the Ethereum blockchain technology and explains how to create a blockchain that is connected to a Java application.  Web3j, a wrapper of client remote procedure calls using JSON, manages the transaction interactions with Ethereum clients.  In a second article, he details how to use web3j to query the Ethereum blockchain via its reactive-functional API. He explains how to use RxJava’s Observables to add reactive functionality to the blockchain.  An Ethereum client like Geth or Parity is the first step to getting you started. Clients will synchronize the Ethereum blockchain with one another and provide a gateway to interact with the blockchain. Ethereum takes care of Ether cryptocurrency payment transactions via the network. With just a few lines of code, you can hook up to the Ethereum blockchain and be notified of new blocks being added to the blockchain and start pulling information out of the blockchain in real time. For code and step by step examples, read the full article here  for more information, please visit: web3j project and Conor's blog  p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; -webkit-text-stroke: #000000} span.s1 {font-kerning: none}

How to access a distributed ledger technology blockchain from a Java application using web3j. The Ethereum blockchain is a decentralized platform that is the backbone of a secure, decentralized...

Announcing: Oracle Developer MOOC: Java Microservices

We are happy to announce that registration is open for the Oracle Developer MOOC: Java Microservices. Learn to create Java Microservice applications for deployment to Oracle Cloud Services! The course will start March 13th. Enroll today! In this course you will learn to create RESTful Java microservice applications for deployment to Oracle Cloud Service. You will configure Oracle Developer Cloud Service to automatically build and deploy your application to Oracle Application Container Cloud Service. Microservice applications take the concept of distributed system applications further by completely decoupling application services. Each microservice is a fully independent application with well defined input and output exposed only through RESTful endpoints. The result is a system where any single service can be scaled, replaced and linked to additional services, such as caching, without any architectural changes.This 3-week Massive Open Online Course covers: Introduction to REST and Microservices Building a RESTful Java Application with Spring Boot Automating Build and Deploy with Oracle Developer Cloud Services So click the Enroll button, read the full description of the course, and I will see you on March 13th!

We are happy to announce that registration is open for the Oracle Developer MOOC: Java Microservices. Learn to create Java Microservice applications for deployment to Oracle Cloud Services! The course...

General

Congratulations New Java Champion Oliver Gierke

Welcome New Java Champion Oliver Gierke Oliver Gierke is leading the Spring Data project at Pivotal. He is an active member of the JCP expert group on JPA 2.1 and one of the main organizers of the JUG Saxony Day, OOP, JAX and WJAX conferences. Oliver coined the Spring Data repository programming model which is a widely used Java abstraction to develop data access layers for relational and non-relational databases. This simplifies the way Java developers interact with persistence technologies as Spring Data provides an abstraction over APIs such as JPA. He is one of the leading experts on JPA and other persistence technologies. With Spring Data REST, he helped Java developers implement REST APIs. He also coined the Spring HATEOAS module and helped Java developers use hypermedia elements in REST APIs when using Spring MVC or JAX-RS. Oliver is a consulting lecturer at the Chair of Software Engineering at TU Dresden helping students to get started with application development in Java. All of his material is available online: http://static.olivergierke.de/lectures/ This makes it easy for student developers to experiment with Java and receive a professional introduction to the language and Java development practices.  Oliver contributes almost daily to diverse Open Source frameworks on Github, see https://github.com/olivergierke.  He is a frequent speaker at many conferences including BEDcon, OOP, JavaZone, Devoxx, SpringOne, JavaOne, JFokus, Øredev to name a few. Follow him at @olivergierke

Welcome New Java Champion Oliver Gierke Oliver Gierke is leading the Spring Data project at Pivotal. He is an active member of the JCP expert group on JPA 2.1 and one of the main organizers of the JUG...

General

Java and JVM Tools

Java Magazine Editor in Chief Andrew Binstock  Few things are as exciting to us developers as tools. Nearly everything we do, we do indirectly through the use of tools, on which we depend. And in fact, good developers are always characterized by deep knowledge of the tools they use and how best to apply them. With this in mind, in our first article (page 17) we examine the latest evolution of Maven, called Polyglot Maven, which frees us from creating build files in XML. Polyglot opens the door to using real scripting languages for writing build files. This idea is taken one step further in our article (page 22) on a new build tool, Kobalt, being written in the JVM language Kotlin, a Java-like JVM language. This article is actually more about the architecture of build tools-what goes on underneath the covers. However, the author's design uses Kotlin as the language for defining the build. In this way, as he points out, not only do you gain true expressivity in the build file, but your IDE can now catch errors as you describe your build. (The increasingly popular build tool Gradle is moving in the same direction: migrating its build files from Groovy syntax to Kotlin.) We also cover (page 29) the uncommon, but not rare, a situation in which your debugger does not give you all the information you need to fix your code. We examine a debugging API for the JVM that enables you to extract information about running processes, view variables and classes, query counters, and get at details you might need. This information is surprisingly easy to access and enables you to write one-off debugging scripts to solve unusual or complex problems. To complement this information, Oracle's architect for the Java language, Brian Goetz, discusses lexical language changes supporting local variable type inference (page 60). We follow that discussion with a deep dive into Scala, which is consistently ranked among the most popular JVM languages. (page 47). Finally, one of the coolest articles (page 36) we've run in a long time: how to get started programming Blockchain, the technology behind cryptocurrencies. Remember that you can read the issue online. Or, if you prefer, you can download it in PDF format. For the download option, access the magazine from a laptop or desktop and you'll see the download icon on the right.

Java Magazine Editor in Chief Andrew Binstock  Few things are as exciting to us developers as tools. Nearly everything we do, we do indirectly through the use of tools, on which we depend. And in fact,...

Java EE Recap

For those of you who are not looking at the Java EE mailing list and news on a regular basis, this blog will give you a summary of Java EE JSR progress.  At JavaOne during his keynote, Anil Gaur explained the overall direction of Java EE and the roadmap for Java EE 8 and 9, planned for 2017 and 2018, respectively. Watch his keynote here. The Java EE survey results came in last month, showing the community ranking of future Java EE technologies and conclusions for the Java EE 8 proposal. This proposal includes Servlet 4, JSON-P 1.1, JSON-B 1.0, Java EE Security, JAX-RS 2.1, JSF 2.3, CD 2, Bean Validation 2 and a stronger alignment with Java SE 8. For feedback on Java EE 8, please join the project. Java EE 8 release has an aggressive schedule and the spec leads and community members have shared updates on those JSRs Context and Dependency Injection (CDI) 2.0 Beta 1 has been released. Laird Nelson wrote a three-part series about CDI 2.0: fun with composition. His blog describes how CDI 2.0 containers make writing portable extensions easier. “Portable extensions don’t need to know anything about the main method. User code doesn’t need to know anything about portable extensions.” For more news about CDI 2.0 follow the twitter account @cdispec and CDI blog  The JAX-RS 2.0 announced an early draft in Q1 this year. Pavel Bucek is joining the project as a new lead for JAX-RS 2.1. [ Mailing list, JSR 370 ] Spec lead Gunnar Morling wrote a detailed Bean Validation 2.0 progress report. In his blog, you will learn about the support for Java 8 and much more. [JSR 380] Senior developer Zaery Moghaddam wrote the detailed “getting started with JSON-B” article. JSON Binding (JSON-B) provides mapping between JSON data and Java objects. He also created the  Java API for JSON Binding website.  There is a proposal to transfer MVC project to the community. The EC will be voting on it and the ballot will close Jan 31st. [JSR 371] JSF 2.3 is in Public Review Draft. Arjan Tijms wrote a detailed summary about what’s new [JSR 372] On Twitter, you can find Java EE news by checking Java EE Moments on the @Java account. 

For those of you who are not looking at the Java EE mailing list and news on a regular basis, this blog will give you a summary of Java EE JSR progress.  At JavaOne during his keynote, Anil Gaur...

Code One

Top 12 JavaOne Sessions!

Have you caught up with JavaOne 2016 sessions yet? The premier conference took place only three months ago. Whether you are considering the next step in your career or just want to make your job easier, consider taking a look at the recorded talks.   To help you scan and watch the topics you are most interested in, check out the blogs on the top 12 sessions. You will find an outline and chapters for each of those talks. Or watch the entire video following the video links below.   1. Learn Java 8: Lambdas and Functional Programming by Henri Tremblay Blog Video  2. A Few Hidden Treasures in Java 8 by Venkat Subramaniam Blog Video  3. JDK 9 Language, Tooling, and Library Features by Joe Darcy Blog Video  4. Docker For Java Developers by Arun Gupta Blog Video  5. Rapid Development Tools for Java EE 8 by Gaurav Gupta and Geertjan Wielenga Video  6. Refactoring to Functional Style with Java 8 by Venkat Subramaniam Blog Video  7. Core Software Design Principles by Venkat Subramaniam Blog Video  8. Collections Refueled by Stuart Marks Blog Video  9. Java Libraries You Can’t Afford to Miss by Ixchel Ruiz, and Andres Almiray Video Article  10. Java EE: The Most Lightweight Enterprise Framework? by Sebastian Daschner Video Article  11. Introduction to Modular Development by Alan Bateman Video 12. Microservices for Mortals by Bert Ertman Blog Video Big Kudoos to top speakers!  Plan to join the conference this year 

Have you caught up with JavaOne 2016 sessions yet? The premier conference took place only three months ago. Whether you are considering the next step in your career or just want to make your job...

General

Congratulations New Java Champion Norman Maurer

Welcome New Java Champion Norman Maurer Norman Maurer is an expert on building Java-based high performance network frameworks and services on the JVM. This includes low-level programming (including JNI) as well as implementing protocol codecs. He has a strong background in asynchronous non-blocking code as well as all things related to network protocols. Norman is one of the core developers of Netty, an asynchronous networking framework on the JVM that won a Duke’s Choice Award. His work includes writing concurrent code as well as applying the JNI. He wrote the initial native transport for Netty (https://github.com/netty/netty/tree/4.1/transport-native-epoll) which aims to be used on Linux production systems to reduce latency and uses Linux-only features like Edge-Triggered, So_Reuseport, Tcp_Cork, Tcp_Notsent_Lowat, Tcp_Fastopen, Tcp_Info and Unix Domain Sockets. In addition, Norman implemented most of Netty native SSL which supports OpenSSL, LibreSSL and BoringSSL. This is a drop-in replacement for the default SSLEngine shipped as part of the JDK. He is the author of “Netty in Action” and a frequent speaker at user groups and conferences such as JAX, EclipseCon, QCon and more.  Netty is used by Apple, Facebook, Twitter, Google, Square, Linkedin, Netflix and many other companies. Norman is a member of the Apache Software Foundation and a contributor to many OpenSource Projects over the past years such as Apache James, Vert.x, ActiveMQ, Apache Cassandra, JCTools, and Datastax Java Driver for Cassandra. Follow him on Twitter at @normanmaurer Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Learn more about Java Champions.

Welcome New Java Champion Norman Maurer Norman Maurer is an expert on building Java-based high performance network frameworks and services on the JVM. This includes low-level programming (including...

General

Get Ready and Contribute to JDK 9

Learn how to contribute to JDK 9 and test your code with the early access release. In this introduction to JDK 9, you will learn about HTTP 2, JShell and the Java 9 module system. This is the first session of a series organized by vJUG and IceJUG as part of their global adoption and outreach effort through the release of Java 9.    Discover how to join the Java Community Process (JCP) program and participate as either an individual, corporation, or nonprofit such as a Java user group (JUG). Learn how you can participate in the Adopt-a-JSR and Adopt OpenJDK programs. Currently, there are new JSRs being submitted and developed for the Java EE 8 and Java SE 9 platforms. Find out how you can contribute to the Java Standard.  Mani Sarkar and Hendrik Ebbers (@hendrikEbbers) present a number of demos:   Mani Sarkar describes steps for testing with the latest build. He also talks about jdeps, a tool to test program dependencies and much more.  Hendrik Ebbers shows how to start with REPL: Lesson 1 - What is JShell  Lesson 2 - Start JShell  Lesson 3 - Variables and Methods in JShell Additional functionality with JShell  Lesson 4 - Http calls with Jshell In lesson 5, Mani introduces the module system in Java 9  Q&A sessions about Java 9 features, performance, module system, process of creating standards and more.  Additional links mentioned in these presentations:  Download the JDK 9 early access download:  JDK 9 JEP  Guide for testing on latest build of java9:  Provide feedback 

Learn how to contribute to JDK 9 and test your code with the early access release. In this introduction to JDK 9, you will learn about HTTP 2, JShell and the Java 9 module system. This is the first...

General

Java EE 8 Overview

Linda DeMichiel, Java EE 8 Specification Lead, presents an overview of the original proposal for Java EE 8 JSRs and the proposed changes to the Java EE.  She details the revised proposal for Java EE 8, which is only a proposal since the expert groups will work on the JSRs.  The proposal is to consider in parallel features in Java EE 8 and 9 and not to wait for the release of Java EE 8 to discuss Java EE 9. In this plan, Java EE 9 should have an in-depth focus on cloud and microservices, leveraging the work done in 8.  Linda discusses in more detail the proposal of changes in Java EE 8 here.  She explains the rationale for the proposed changes and the technical focus areas in Java EE 8. Part of the proposal is to enable a full reactive programming model in Java EE 9.  More information about the JSRs discussed during these sessions are available online. Here is the list of JSRs:  - JSR 365: Contexts and Dependency Injection 2.0. The goal is to make CDI modular and separating CDI into Core CDI, Java SE, Java EE.  - JSR 374: JSON Processing 1.1. The goal is to include standards like Json pointer, patch and merge patch.  - JSR 367: JSON Binding 1.0. The goal is to provide mapping between JSON data and Java objects. It provides a standard support to handle JSON media type for JAX-RS.  - JSR 370: RESTful Web Services (JAX-RS 2.1). The goal is to improve server-to-server communication, server-sent events, non-blocking I/O, asynchronous clients with reactive programming, hypermedia API and integration with other JSRs like CDI and other frameworks. The Jersey reference implementation has made good progress but has not yet been approved as a standard.  - JSR 369: JavaTM Servlet 4.0 Specification. The goal is to support for HTTP/2 and compatibility with HTTP 1.1. The early draft review is available.  - JSR 372: the next release of Java Server Faces JSF 2.3. It is a mature technology with some improvements such as better CDI and WebSocket integration, Ajax method invocation and date and time support.   - JSR 375: Java EE Security API 1.0. The goal is to simplify, standardize, and modernize the Security API across the platform. There is a proposal to simplify managing users and groups. Also improvements related to password aliasing, role mapping, authentication and authorization with CDI support. The second renewal ballot is planned in November.   - JSR 380: Bean Validation 2.0. The goal is to leverage Java 8 language constructs, like optionals, date and time API, and repeatable annotations.     

Linda DeMichiel, Java EE 8 Specification Lead, presents an overview of the original proposal for Java EE 8 JSRs and the proposed changes to the Java EE.  She details the revised proposal for Java EE...

General

Java EE - the Most Lightweight Enterprise Framework?

How does Java EE compare to other enterprise frameworks? What criteria make a framework lightweight? Sebastian Daschner in this new article makes the case that the Java EE platform is lightweight and improves productivity.  He explains how APIs contained in the Java EE umbrella offer a productive and enjoyable developer experience while providing seamless integration with standards such as Contexts and Dependency Injection (CDI), JAX-RS, JSON Processing (JSR 353), and Bean Validation.   Real-world applications don’t need a lot of configuration because of the convention-over-configuration driven approach of Java EE. Java EE 7, when used together with Java 8, comes with enough functionality to cover the majority of use cases without any other dependencies.  Java EE is the perfect framework to be used in container technologies such as Docker since the deployment implementation is already contained in the runtime. Sebastian recommends separating business logic from the runtime if possible. This means packaging the application in a WAR file that contains only the application's code.  In the article’s summary, he recommends:     •    Using Java EE 7 and Java 8 only with the API being provided     •    Building a kilobyte-sized WAR file containing only the business logic plus minimal plumbing (such as JAX-RS resources or JPA)     •    Building a Docker image—adding only a WAR file to a base image containing the configured application server     •    Shipping via a CD pipeline that deploys the application using containers Read the full article for a more complete description.

How does Java EE compare to other enterprise frameworks? What criteria make a framework lightweight? Sebastian Daschner in this new article makes the case that the Java EE platform is lightweight and...

General

Modular and Reusable Java EE Architecture with Docker

Learn how to modularize your Java EE applications using Docker. In this second part of their series on Docker and Java EE, Bruno Souza, Elder Moraes, and André Carvalho explore a simple process for using Docker containers to provide all the services a Java EE application requires.  As the authors point out, software containers can help you manage and tame the complexity of providing services for expandable infrastructures. Containers make it easy to create complex infrastructures that are composed of many moving parts. Containers can also help with automation, and they can ease the creation of complete development-test-deploy pipelines. And, perhaps best of all, containers allow for the reuse of infrastructure components in multiple projects and environments.  The article describes taking an existing application and reworking it so that all the required services are provided through containers.  The seven steps described in this article are:  1. Start from your own Java EE application. 2. List all the services you are using now: application server, database, message queue, and so on. 3. Docker Hub may have ready-to-use images for some or all those services. Do a search there, read about the images; look for the ones that are suitable for your project. 4. Consider defining your own image. You might need to if there is no suitable image for a service or your application requires extensive configuration. 5. Either use the images directly (such as Cassandra and ActiveMQ in our example) or start from an existing image and add your customizations (as we did with the PostgreSQL image). 6. Start your containers to get your services up and running. 7. Create the container for your application. Remember to link it to the service containers. This will allow the containers to communicate. See the requirements of your orchestration platform.   Get a full understanding of the process by reading the article.  In Part 1 Step-by-Step High Availability with Docker and Java EE, Bruno Souza and Elder Moraes describe how to combine Java EE and Docker to develop and deploy portable, scalable, highly-available services.  

Learn how to modularize your Java EE applications using Docker. In this second part of their series on Docker and Java EE, Bruno Souza, Elder Moraes, and André Carvalho explore a simple process for...

General

JUnit 5 - A Special Issue!

By Guest Blogger Andrew Binstock JUnit 5 is about to be released and this special issue of Java Magazine tells you what's new and how to use the features added in this release. We start off with an overview of the new features, followed by an article showing how to include JUnit 5 in your build and how to run tests from v4 and v5 together. For readers who want to know more about the capabilities and how to use more-obscure features, we do a deep dive into this release's architecture, which is substantially different from earlier versions. We follow this with an interview with Kent Beck, who was the parent of JUnit through its first four releases. He also popularized test-driven development (TDD), and created extreme programming (XP), the set of techniques that evolved into Agile programming. In its original formulation, TDD and strongly promoted the idea that no code should be written without first having written a failing test. As this interview explains, Beck's view on what code requires failing tests or, in fact, any tests at all has evolved significantly. We finish up our coverage of JUnit with a lengthy article on mutation testing, which is a little-known but highly effective technique. It validates unit tests on projects that require a high level of integrity (that is, truly mission-critical code). Mutation testing goes through the bytecodes of unit tests and runs the tests while making small changes to what they test. Did the changed test fail or throw an exception? If not, is the test exercising the code as you think it is? By assessing these failures, mutation testing reveals incomplete or slightly incorrect tests. We round out this issue with an editorial on the future of NetBeans now that the IDE will be moving out of Oracle's sponsorship; a demonstration of how to implement the most common design patterns in Java; an explanation of using the cloud for development; and a guide to contributing to JSRs and other Java standards. And, of course, our famous Java quiz. Remember that you can read the issue online. Or, if you prefer, you can download it in PDF format. For the download option, access the magazine from a laptop or desktop and you'll see the download icon on the right. You'll also note that you can now access back issues of Java Magazine from this year and last year. We'll eventually make all our back issues available to subscribers. To go to the back issues, click on the topmost icon in the right panel, you'll see a table of contents for the current issue and a list of the back issues from 2015 and 2016. Highlight the one you want to read, then click on the View button at the top of the panel. You can download any of the back issues as a PDF file.

By Guest Blogger Andrew Binstock JUnit 5 is about to be released and this special issue of Java Magazine tells you what's new and how to use the features added in this release. We start off with an...

Java

Congratulations New Java Champion Richard Warburton

Welcome New Java Champion Richard Warburton!    Richard Warburton is an empirical technologist and solver of deep-dive technical problems, working independently as a software engineer and trainer. He’s worked as a developer in diverse areas including low latency trading systems, statistical analytics, static analysis, and compilers and network protocols.  Richard has been involved in the London Java Community (LJC), organizing monthly hackdays which have helped get hundreds of developers over the first step to contributing to open source Java projects including the OpenJDK.  He also led the Adopt-a-JSR programs for both Java 8 Date & Time and Lambda Expressions at both the LJC and international events and conferences. He has been previously recognized for these efforts by being nominated for JCP Member of the Year in 2014 as an individual and jointly nominated for JCP Member of the Year with 3 other LJC members in 2013. Within the open source community, Richard initiated and leads the Honest Profiler project. This is a profiler designed to solve the problem of safepoint sample bias and offers significantly more accurate profiling information than things like JVisualVM. He also initiated the Lambda-Behave testing project which demonstrated the use of the new Java 8 language features to make more fluent and readable domain specific languages. His experience also extends to OpenJDK itself, where he helped make important technical and social contributions to get the new Date & Time library into Java 8. Richard helped develop and maintain the Aeron, Agrona, and SBE projects. These are a unique set of libraries that offer native-code beating performance from within the safety of a JVM. He has developed innovative bug finding algorithms that analyze multiple versions of Java software simultaneously to identify and solve human errors. Richard helped pioneer an innovative use of machine learning when working on software for identifying software performance bottlenecks on the JVM. Working on his PhD, Richard developed a class of domain specific languages for optimizing Java bytecode and showed how they could be formally verified in order to ensure that no bugs were introduced in the programs being optimized. Richard authored the O'Reilly book "Java 8 Lambdas" and the mini-book "Object-Oriented vs. Functional Programming" - both on Java 8/functional programming topics. He writes about technology and Java on http://insightfullogic.com/ and Pluralsight blogs. He runs in person training courses across Europe and in America on http://iteratrlearning.com. He has published video training courses with Pluralsight and Parleys on Java. Richard is a frequent speaker at Devoxx, JavaOne, QCon SF, JFokus, Devoxx UK, Geecon, Oredev, JAX London, JEEConf, Codemotion, JProfessionals and (soon) Voxxed Days Luxembourg. He has also contributed to the program committee of Javaone and Devoxx UK for multiple years. Follow him on Twitter @RichardWarburto 

Welcome New Java Champion Richard Warburton!   Richard Warburton is an empirical technologist and solver of deep-dive technical problems, working independently as a software engineer and trainer. He’s...

General

Congratulations New Java Champion Amira Lakhal

Welcome new Java Champion Amira Lakhal! Amira has been working as a Java developer for over seven years. She worked as a consultant for many companies in the banking, transportation, services, and manufacturing sectors. She is an open source contributor and an active organizer of Duchess France.   Amira developed an app combining a smartphone sensor and two open source projects (Cassandra DB and Spark) using a machine learning algorithm to predict user activity. Her work is available on her Github account. It has been used by an insurance company in Paris to help detect collisions between motorcycles.  She contributed to MoovSimply: a responsive app to help users find the nearest means of transportation. http://store.bemyapp.com/app/moov-simply/. She also contributed to an event aggregator, One Calendar, combining a search engine to find tech events with a calendar application.  Amira is active in Duchess France, a branch of the global organization JDuchess. Duchess France, with a current membership over 1000, has provided a platform through which technical women working in IT can connect with each other and get involved in the larger IT community since 2010.  Amira is a frequent speaker at Devoxx Belgium, Devoxx Morocco, Devoxx France, JFokus, Scalar, GeeCon, J_OnTheBeach and JUGs in France and Switzerland. Follow her on Twitter @MiraLak

Welcome new Java Champion Amira Lakhal! Amira has been working as a Java developer for over seven years. She worked as a consultant for many companies in the banking, transportation, services, and...

General

New Java Champion Badr El Houari

Welcome new Java Champion Badr El Houari! Badr El Houari is a serial entrepreneur and senior technologist with over 9 years of experience designing, architecting and building efficient IT solutions for big IT companies. He co-founded the MoroccoJUG (Morocco Java User Group) in 2009 which was the first EMEA organization to join the Java Community Process as an executive committee member in 2013.  Badr is a true open source enthusiast and has contributed to many open source projects including Arquillian and Agorava. He is a Java EE enthusiast and a contributor to Java EE specs including CDI, JAX-RS, JSON processing and JSF. He is also involved with OpenJDK, JBoss AS 7 and more. He also created the Java Education Moroccan initiative (JEMI), introducing future developers to Java and Java EE at Moroccan universities.  Badr has a passion for promoting Java related technologies in Africa. He co-founded the JMaghreb conference in 2012, which quickly became the biggest developer conference in Africa and Middle East. JMaghreb was rebranded Devoxx Morocco in 2015. He's also organized Voxxed Days Dakar, Algiers, and Dubai; created a chapter of Devoxx4Kids in Morocco, and helped create Devoxx4Kids Dakar, Algeria and Tunisia. His goal is to encourage African developers to innovate and contribute more to the IT world.  Badr is a frequent speaker at local and global developer conferences at JavaOne, Devoxx BE, Devoxx FR, JCertif, Web2Days and many JUGs around the globe. Follow him on Twitter @badrelhouari  Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Learn more about Java Champions.  p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px 'Helvetica Neue'; color: #8899a6; -webkit-text-stroke: #8899a6} span.s1 {font-kerning: none} span.s2 {text-decoration: underline ; font-kerning: none}

Welcome new Java Champion Badr El Houari! Badr El Houari is a serial entrepreneur and senior technologist with over 9 years of experience designing, architecting and building efficient IT solutions for...

General

New Java Champion: Andrzej Grzesik

Congratulations to the newest Java Champion Andrzej Grzesik!  Andrzej is a seasoned developer in high velocity software dealing with large amounts of data. He is an expert on Big Data and Java-focused deployment. He has a highly regarded blog in the industry.  Andrzej is a main contributor of AirCasting, an FOSS project for crowd-sourcing environment monitoring data. He has also cofounded GeeCON, a world-class Java-centric conference, and the Krakow Software Craftsmanship community. He spent time teaching and promoting good design and proper coding practices. He was one of the organizers of a number of Code Retreats, events which teach people to write better tested code.  Andrzej started a Programming Club at his university (it’s still running!), organizing the biggest student Computer Science conference in Poland (sfi.org.pl) and in his work as a Sun Campus Ambassador.  He is now a well-known and popular speaker (e.g., most-wanted speaker at this year’s JDD) at software development conferences (JavaONE, JFokus, Devoxx, GeeCON, JDD and more).  In addition to presentations, he also gives workshops on topics revolving around the Java ecosystem.    He teaches tech speaking skills to encourage people to participate and present at events. Some of his mentees have spoken at this year’s world-recognized HTML5 Developer Conference and GeeCON. Follow him on Twitter at @ags313 and visit his GitHub account at https://github.com/ags313 Java Champions are an exclusive group of passionate Java technology and community leaders who are community-nominated and selected under a project sponsored by Oracle. Learn more about Java Champions. 

Congratulations to the newest Java Champion Andrzej Grzesik!  Andrzej is a seasoned developer in high velocity software dealing with large amounts of data. He is an expert on Big Data and Java-focused...

General

The Java Trove: Part II

Which tools and frameworks do you need for testing a JavaFX application? Almiray chose JUnit, one of the most popular testing frameworks. In Java Trove part 1, Almiray built a JavaFX application to query REST-based API and display results. if you recall, the application used Retrofit to define a Java-based wrapper on top of GitHub’s REST API; Jackson to transform the JSON into Java beans; the byte code generation tool was Lombok; Deferred help invoke call outside of the UI thread; MBassador for event handling; and Guice.  In this article, Almiray shows how to test the controller code, whose purpose is to react to user input, create network calls outside of the UI thread, and then update the UI. He also demonstrates how to perform integration tests. He uses JUnit as the base test framework and chooses Mockito to facilitate setting up fake collaborators, expectations, and mocks. Jukito ups the ante by adding support for automatic mocks and Guice support since the production code relies on Guice as a dependency injection container. Concurrency and multithreading is tested with Awaitility and WireMock to set up a fake HTTP server. Articles: Java Trove Part I and Java Trove Part II . Almiray did a JavaOne presentation about the same libraries: Java Libraries You Can’t Afford to Miss 

Which tools and frameworks do you need for testing a JavaFX application? Almiray chose JUnit, one of the most popular testing frameworks. In Java Trove part 1, Almiray built a JavaFX application to...

General

Lambdas with Collections and Method References

How to use lambda expressions with existing Java APIs and with method referencing to increase code reuse and improve productivity. Java 8 first introduced the Stream API with the Java Collections Framework. In this new article, Mohan Basavarajappa dives into the package Java.util.function, collection classes and stream references use cases for day-to-day programming.   To show how to combine collection classes with lambda expressions, Mohan describes four examples: create an array with a collection and perform operations on those collections; use client code to perform an operation on the collection; remove elements from a collection; and evaluate elements with Consumer API.  Method references can complement lambda expressions. Mohan demonstrated how to leverage existing implementations while using functional interfaces and also how to use method references as a substitute for lambda expressions. His collections and method referencing examples cover situations in which lambda expressions can be used with existing Java APIs to write better code and take advantage of implementations that are readily available with Java 8, as well as cases where functional interfaces are accepted as parameters to inject existing implementations for libraries using functional programming. This article follows “Getting Started with Lambda Expressions” article,  explaining the basics of lambda expressions and their usage. 

How to use lambda expressions with existing Java APIs and with method referencing to increase code reuse and improve productivity. Java 8 first introduced the Stream API with the Java...