Java 9 and its new features add to the richness of the language--one of the most-used languages to build robust software applications. Java 9 comes with a special emphasis on modularity, implemented from Project Jigsaw. This book is your one-stop guide to mastering the changes made to the Java platform. The book gives an overview and explanation of the new features introduced in Java 9 and the importance of the new APIs and enhancements. Some of the new features of Java 9 are groundbreaking, and if you are an experienced programmer, you will be able to make your enterprise application leaner by implementing these new features. You will be provided with practical guidance in applying the newly acquired knowledge in regards to Java 9 and further information on future developments of the Java platform. This book will improve your productivity, making your applications faster. By learning the best practices in Java, you will become the go-to person in your organization for Java 9. By the end of this book, you will not only know the important concepts of Java 9 but you will also have a nuanced understanding of the important aspects of programming with this great language.
Chapter 1, The Java 9 Landscape, explores the most significant features introduced in Java 9, including Project Jigsaw, the Java Shell, G1 garbage collection, and reactive programming. This chapter provides introductions to these topics, priming them for deeper coverage in the subsequent chapters.
Chapter 2, Discovering Java 9, covers several changes to the Java platform to include heap space efficiencies, memory allocation, compilation process improvements, type testing, annotations, automated runtime compiler tests, and improved garbage collection.
Chapter 3, Java 9 Language Enhancements, focuses on the changes made to the Java language. These changes impact variable handlers, depreciation warnings, improvements on Project Coin changes implemented in Java 7, and import statement processing.
Chapter 4, Building Modular Applications with Java 9, examines the structure of a Java module as specified by Project Jigsaw and how Project Jigsaw was implemented as part of the Java platform. This chapter also reviews the key internal changes to the Java platform as they relate to the new modular system.
Chapter 5, Migrating Applications to Java 9, explores how to migrate Java 8 applications to the Java 9 platform. Both manual and semi-automated migration processes are covered.
Chapter 6, Experimenting with the Java Shell, covers JShell, the new command-line read-eval-print loop tool in Java 9. Coverage includes information regarding the tool, the read-eval-print loop concept, and the commands and command-line options for use with JShell.
Chapter 7, Leveraging the New Default G1 Garbage Collector, takes an in-depth look at garbage collection and how it is handled in Java 9.
Chapter 8, Microbenchmarking Applications with JMH, examines how to write performance tests using the Java Microbenchmark Harness (JMH), a Java harness library for writing benchmarks for the Java Virtual Machine (JVM). Maven is used along with JMH to help illustrate the power of microbenchmarking with the new Java 9 platform.
Chapter 9, Making Use of the ProcessHandle API, reviews new class APIs that enable the management of operating system processes.
Chapter 10, Fine-Grained Stack Tracing, covers the new API that permits an effective means of stack walking. The chapter includes detailed information on how to access stack trace information.
Chapter 11, New Tools and Tool Enhancements, covers 16 Java Enhancement Proposals (JEPs) that were incorporated into the Java 9 platform. These JEPs cover a wide range of tools and updates to APIs to make development with Java easier with greater optimization possibilities for our Java applications.
Chapter 12, Concurrency Enhancements, covers concurrency enhancements introduced with the Java 9 platform. The primary focus is the support for reactive programming, a concurrency enhancement that is provided by the Flow class API. Additional concurrency enhancements introduced in Java 9 are also covered.
Chapter 13, Security Enhancements, covers several small changes made to the JDK that involve security. The security enhancements introduced with the Java 9 platform provide developers with a greater ability to write and maintain applications that are more secure than previously possible.
Chapter 14, Command-Line Flags, explores the command-line flag changes in Java 9. Concepts covered in this chapter include unified JVM logging, compiler control, diagnostic commands, heap-profiling agent, JHAT, command-line flag argument validation, and compiling for older platform versions.
Chapter 15, Best Practices in Java 9, focuses on working with utilities provided by the Java 9 platform to include UTF-8 property files, Unicode 7.0.0, Linux/AArch64 port, multiresolution images, and common locale data repository.
Chapter 16, Future Directions, provides an overview of the future developments of the Java platform, beyond Java 9. This includes a specific look at what is planned for Java 10 and what further changes we are likely to see in the future.
To work with this text, you will need at least a basic knowledge of the Java programming language.
You will also need the following software components:
- Java SE Development Kit 9 (JDK)
- An Integrated Development Environment (IDE) for coding. Here are suggestions:
- Eclipse
- IntelliJ
- NetBeans
This book is for enterprise developers and existing Java developers. Basic knowledge of Java is necessary.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, and user input are shown as follows: "Under the subdirectory structure of C:\chapter8-benchmark\src\main\java\com\packt
is the MyBenchmark.java
file."
A block of code is set as follows:
public synchronized void protectedMethod() { . . . }
New terms and important words are shown in bold.
Feedback from our readers is always welcome. Let us know what you think about this book--what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply email [email protected]
, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
- Log in or register to our website using your e-mail address and password.
- Hover the mouse pointer on the
SUPPORT
tab at the top. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box. - Select the book for which you're looking to download the code files.
- Choose from the drop-down menu where you purchased this book from.
- Click on
Code Download
.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR / 7-Zip for Windows
- Zipeg / iZip / UnRarX for Mac
- 7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-Java-9. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books--maybe a mistake in the text or the code--we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata
section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected]
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected]
, and we will do our best to address the problem.