mCommerce. How does it differ from eCommerce?4 January 2019
Dedicated app or mobile website?8 January 2019
In September, Java 11 appeared. The new version is the first planned appearance of long-term versions of Oracle support (LTS). LTS is a new six-month cycle that assumes the creation of a new version of Java.
Java FX 11
Java FX is a technology for creating a graphical user interface. Since 2011, it is an open source project, and with the appearance of versions 11, it was decided that it will no longer be part of JDK, instead it will be available for download independently.
Java FX 11 introduces several new features to the library itself. The most interesting is probably the introduction of the public FX Robot API, which is equivalent to the API Robot from the AWT package. It allows for user actions simulation, i.e. pressing keys, clicking mouse buttons, moving the cursor, or taking screenshots. All of this can be useful, for example, to write a simple game bot.
A new website for the project also had been created, for publishing documentation and application examples, at: openjfx.io.
The list of changes in Java 11 is not very long, but a few elements are definitely worth mentioning from the developer’s point of view.
Until now, you had to do a few things to run any application written in Java.
Write the code, compile it and run it on a virtual machine.Java 11 introduced the ability to directly run codes that are in a single file with the source code. Let’s recall that Java 9, introduced JShell an interactive interpreter that allows you to conveniently execute Java code and test simple things without having to run the environment. The reason for this change is, among others, to reduce the threshold of entry into language learning, allowing for less steps to be taken in order to run the simplest hello world is reduced. Compilation, running, javac, java, virtual machine – for a person who just wants to print a piece of text in the console, it may seem too much. Secondly, this new approach can simplify the writing of short scripts that will improve our daily work. You can now really scratch something in a plain notepad and quickly run it without turning your HDD into a pile of compiled garbage .class files.
API cleaning continues
Java 10 was the first version of Java, for which decision was made to remove selected API elements. This applied mainly to elements that were marked as @Deprecated already in Java 1.2, but due to the high emphasis on backward compatibility, such “garbage” remained available. While only single methods have been removed in Java 10, Java 11 removed, entire modules, mainly those that were related to Java EE and should never get here in the first place. JAXB, JAX-WS, JTA, CORBA modules were removed as well as. the destroy () method from the Thread class, which frankly has never been really implemented.
Small API improvements
There are no major changes from the code point of view, but there are several nice improvements.
- Methods regarding white characters – isBlank(), strip(), stripLeading(), stripTrailing()
- repeat (int repeats) method
- the lines() method returns a stream with lines of text
We have also seen improvements in the NIO package. From now on, in order to save the text to the file, you will no longer need to define the BufferedWriter, instead you get a convenient method Files.writeString (). We get an analogous method to read – Files.readString(). And a method was also created to compare two files – Files.isSameFile().
Two additional garbage collectors were also introduced. The first one called Epsilon is very unusual. Its purpose is not to clean the memory, which may seem absurd, but it can be very useful for testing purposes. The second one called ZGC is to be very efficient in multi-gigabyte scenarios.
Let’s move to technical details. Java 11 introduces(nests), access control mechanism described in JEP 181. It adapts to nested types, so that classes that are logically part of the same unit of code, but which are compiled to different class files, can get direct access to their private fields without the compiler inserting bridging access methods. In addition, it is worth to mention the extension of the class file format with a new form of the constants pool, which flips the creation to bootstrap methods (JEP 309), and the introduction of a new Epsilon garbage collector, which controls the memory allocation, but does not implement memory recycling mechanisms (JEP 318). Java 11 is also a standardised HTTP client (JEP 321), now fully asynchronous, new syntax for parameters in lambda expressions (JEP 323), allowing the use of var keyword when declaring, basic implementation of secure TLS 1.3 communication protocol and several other cryptographic improvements .
The full list of new products can be found in the release notes, but you should remember that among them you will find mentions of removed and abandoned obsoleted technologies. The Java EE and CORBA modules have been removed. Pack200 tools and their API used from time immemorial to compress JAR files have also been removed.
JAVA 12 – coming in March!
In the new six-month Java release cycle, you should expect new, exciting features for developers at a faster pace. The new version of Java will be put into use in March 2019. You can access the Open JDK 12 version earlier and try out some new features such as Switch Expressions and Records.
Commercial support for Java 11 is guaranteed by Oracle for at least next eight years. The next edition of the extended, Java 17 is planned for September 2021.
In conclusion – despite the fact that Java 11 does not bring any revolutionary changes, considering the fact that only 3 months have passed since Java 10, consistent and noticeable progress is noticeable.
Other cool features should be expected with JDK 12 and later. Personally, I appreciate that the Java community is evolving and trying to transfer Java further. In the new six-month release cycle, we should expect faster releases of cool features.