Oracle JDK 9新功能探索(oracle jdk 9)
Oracle JDK 9: Exploring the New Features
Oracle JDK 9, released in September 2017, marks a major shift in the Java platform’s evolution. It brings several new features and enhancements to improve application development, performance, and security. Here are some of the key features that developers need to explore.
Modular System – Jigsaw
The most significant feature of JDK 9 is the modular system, also known as Project Jigsaw. Jigsaw offers a standards-based module system for the Java platform, which allows applications to be built and run as smaller, independently deployable modules. Jigsaw provides a way to organize code and dependencies, making it easier to create and mntn large applications.
For example, with Jigsaw, an application can only include the required modules, rather than bundling everything into a single package. This approach reduces the dependencies and overhead, making the application faster and easier to mntn. Jigsaw also enhances the security of the Java platform by encapsulating critical APIs within modules.
JShell – Interactive Java Shell
Another significant feature in JDK 9 is JShell, a Java REPL (Read-Eval-Print Loop). JShell lets developers evaluate Java code snippets interactively, making it easier to learn Java language syntax and API. JShell is particularly useful for developers who are new to Java, or for those who want to quickly experiment with ideas and test code.
JShell provides immediate feedback on the execution of code, allowing developers to quickly spot errors and fix them. JShell also remembers the previously entered commands, making it easier to reuse code snippets.
Process API Updates
JDK 9 also includes updates to the Process API that allow developers to control and manage operating system processes easily. The new Process API provides a way to start and stop processes, monitor their status, and perform other operations, such as redirecting input and output streams.
The enhanced Process API makes it easier to create and manage long-running processes and improves the integration between Java applications and operating system processes. This integration allows Java applications to interact with other native applications, making it easier to build complex, multi-platform systems.
HTTP/2 Client
JDK 9 includes a new implementation of the HTTP/2 client API. The new HTTP/2 client improves the performance of HTTP communications by reducing the overhead of multiple requests and responses. The new client also supports server push, which allows the server to send additional resources to the client, without wting for the client to request them.
The HTTP/2 client API provides a convenient way to send HTTP requests and receive responses asynchronously. This approach makes it easier to build scalable, high-performance applications that consume web services.
Conclusion
Oracle JDK 9 introduces several new features and enhancements that improve the Java platform’s performance, security, and ease of use. Developers can take advantage of these features to build better applications, reduce dependencies and overhead, and improve mntnability. As Java continues to evolve, JDK 9 plays an essential role in shaping its future.