Java 17: new features and downloads
Everything you always wanted to know about Java 17: improvements, new features, downloads, training.
Java is a programming language that is indispensable to IT development, insofar as many evolutions are based on its use: used on computers, smartphones and game consoles alike, it is proving to be indispensable. It is published by Oracle.
For a long time, Java opted for a release cycle of several years between each version. Version 9 comes with a real novelty: since its release, Java has offered a new version every 6 months! Version 17, released in September 2021, is the last LTS (long-term support) of the language before the one scheduled for the end of 2023.
You’ll know all about Java 17 after reading this article! But first, what exactly is Java 17?
Java 17 overview
This is a major versionwhich represents the culmination of Oracle’s ongoing efforts to improve and modernize its flagship programming language. Oracle has not only built on previous versions of Java, but has also taken programming trends into account in proposing this new version.
Java 17 is the result of numerous performance improvements, new language features, bug fixes and security enhancements. In line with Oracle’s launch strategy, as an LTS version, Java 17 benefits from a long-term supportwhich means it will receive security and bug updates for an extended period. This is a significant advantage, making this version particularly suitable for use in production environments.
In fact, long-term support not only extends the software’s maintenance period, but also modifies the type and frequency of patches to reduce risks and interruptions to software deployment, while promoting its reliability.
Java 17 is used to develop a wide range of software applications. Why use this programming language rather than another?
And Java 21? Fall 2023 will see the release of the new LST Java 21 version. What can we expect from it? Oracle announces, among other things, the use of virtual threads as a preview feature, even simpler syntax and sequenced collections. Oracle is following the trend with a simpler and, above all, more secure language. We'll be sure to get back to you!
Why use Java 17?
Benefits of Java 17
Here are some of the most notable benefits of Java 17:
- Improved performance with support for macOS and AArch64 using JEP 391. It supports the Apple (M1) processor series.
- A new license, free and more open than the previous one: with Java 17, Oracle is releasing the JDK under a new license called “Oracle No-Fee Terms and Conditions” (NFTC). This license authorizes in-house use of unmodified programs for development, prototyping, demonstration and testing purposes, or for some commercial operations.
- A widely-used language: according to New Relic’s report
State of the Java Ecosystem
released in 2022, Java 17 has overtaken Java 6, Java 10 and Java 16 in the few months since its release. Similarly, according to
Statista
Java is the 5th most widely used language among developers.
- Massive adoption of containerization, driven by performance and efficiency requirements, particularly in Cloud environments.
- Shorter intervals between Long Term Support (LTS) releases: since enterprise applications make extensive use of Java, stability is essential. LTS versions have been created to provide users with extended support. As a result, these versions are naturally more stable and secure. Since Java 17, the interval between LTS versions is now two years instead of three.
Java 17 improvements over previous versions
In this section, we’ll take a closer look at some of the additions Java 17 has made to its predecessors, and concentrate on its programmatic aspects.
Sealed classes and interfaces
We are all familiar with inheritance, the founding pillar of object-oriented programming logic. With sealed classes, it is now possible to precisely define the perimeter of a class, indicating which classes will be allowed to inherit from it. The same applies to interfaces and their implementations. The implementation of this new feature involves the addition of 2 keywords:
sealed
and
permits
. Let’s look at an example:
Here I’ve defined a sealed interface called Service (note the presence of thesealed keyword ). Only the Car and Truck classes can implement this interface, thanks to the permits keyword .
Text blocks
Now it’s easy to create text blocks! This new syntax is very useful for writing xml or json, for example.
Note that spaces are preserved, so the indentation of the text block is respected.
Type Record
A record makes it easy to create immutable objects. Here’s an example with a Person class, which contains data linked to a person (name, age…).
Here is the syntax used in most cases before Java 17 to define this class:
And here is the new Java 17 syntax:
As you can see, record attributes are defined in a much more readable way, requiring less tedious code. There is, however, one notable constraint with this new type: since the class is final, it cannot inherit from other classes.
Pattern matching
This feature concerns the keyword
instanceof
keyword, which is used to check the type of an object.
It is no longer necessary to create an object by casting. With the new syntax, the object is created when instanceof is called, and its properties can be called directly afterwards, without having to use a temporary object.
New Switch
The new switch syntax drastically reduces the number of lines of code:
As you can see from the example above, it is now possible to return a value using a switch.
In addition, the new switch allows you to include the new pattern matching syntax presented in the previous paragraph, and to create conditions in :
Now that you’ve learned more about how Java works, how do you download it?
How to download Java 17
Check that no previous versions are installed on your OS
To do this, launch the command prompt and write “java – version”. If no previous version is installed, you will see the following message: “‘java’ is not recognized as an internal or external command, executable program or command file”.
If not, you must uninstall the previous version.
Download the kit for your OS
To do this, access the
archive versions on Oracle
and select 17. As Oracle reminds us, older versions of the JDK (development environment) are provided to help developers debug problems on older systems. They are not updated with the latest security patches and are therefore not recommended for production use.
How do I learn Java 17?
We suggest 2 methods, which are valid for every version of Java.
For the self-taught: books, tutorials, articles...
Of course, we advise you to choose relatively recent documents, which take into account the latest technological developments.
The Internet is full of valuable information to help you make sense of it all.
For example, we can recommend certain YouTube videos, such as the channel
Graven Développement
.
Similarly, the
MOOC
created by the Ecole Polytechnique de Lausanne can provide you with an effective foundation in coding with Java.
For experienced developers: certifications
Certifications have two key benefits: the first is to encourage you to become an expert in your field, and the second is to offer recognition of your skills and knowledge. Among the existing certifications, we will present two.
- Java Foundations 1Z0-81 certification This is the first certification a new Java developer should obtain. This is a fundamental level exam, demonstrating your understanding of the Java language and programming concepts. It validates your skills in writing and executing a Java program, working with the Java Development Kit (JDK) and the Java Runtime Environment (JRE).
- Java SE 17 certification (1Z0-829) This 90-minute exam certifies you as an Oracle Professional Developer for Java 17.
You now have all the keys you need to tackle Java 17 with peace of mind! We hope you have found this article useful. We invite you to consult the articles in our Qim Tech who can enlighten you on other points. Likewise, our Custom Software Development experts are at your service.