Book Image

Java 9 Programming Blueprints

By : Lee
Book Image

Java 9 Programming Blueprints

By: Lee

Overview of this book

Java is a powerful language that has applications in a wide variety of fields. From playing games on your computer to performing banking transactions, Java is at the heart of everything. The book starts by unveiling the new features of Java 9 and quickly walks you through the building blocks that form the basis of writing applications. There are 10 comprehensive projects in the book that will showcase the various features of Java 9. You will learn to build an email filter that separates spam messages from all your inboxes, a social media aggregator app that will help you efficiently track various feeds, and a microservice for a client/server note application, to name a few. The book covers various libraries and frameworks in these projects, and also introduces a few more frameworks that complement and extend the Java SDK. Through the course of building applications, this book will not only help you get to grips with the various features of Java 9, but will also teach you how to design and prototype professional-grade applications with performance and security considerations.
Table of Contents (13 chapters)
9
Taking Notes with Monumentum

Bootstrapping the application


As noted in the introduction, this will be a JavaFX-based application, so we'll start by creating the skeleton for the application. This is a Java 9 application, and we intend to make use of the Java Module System. To do that, we need to create the module definition file, module-info.java, which resides in the root of our source tree. This being a Maven-based project, that would be src/main/java:

    module procman.app { 
      requires javafx.controls; 
      requires javafx.fxml; 
    } 

This small file does a couple of different things. First, it defines a new procman.app module. Next, it tells the system that this module requires two JDK modules: javafx.controls and javafx.fxml. If we did not specify these two modules, then our system, which we'll see below, would not compile, as the JDK would not make the required classes and packages available to our application. These modules are part of the standard JDK as of Java 9, so that shouldn't be an issue. However...