Text by / Lin Bentuo
##In the first part, the main content is explained as follows:TipsWhat difficulties did the Jigsaw project encounter that took so many years to complete? The main goal of Jigsaw is to provide Java developers with a way to develop applications using software components called modules. A module can export its API for public use and encapsulate its internals. Modules can also declare dependencies on other modules, and these dependencies can be verified at startup to avoid missing type errors at runtime. The JDK itself is divided into a series of modules that interact with each other. This provides a scalable runtime. If your application uses a subset of the JDK, you can create a runtime image that contains the JDK modules used in your application and application modules. All these features of the module system look normal. The main issue that has always troubled JDK designers is backward compatibility and migration of the module system. Java has been around for over 20 years. Any significant features, including the module system, must be easily applicable. Based on feedback from the Java community, it went through several iterations of redesign and improvement, and finally got to where it is now. Another important addition to JDK 9 is JShell, Java’s interactive programming environment. JShell is a command line tool and API that allows executing a piece of code and getting instant feedback. Before JShell, you had to write a complete program, compile it and run it to get the results. JShell is a tool you use in your daily development. JShell is essential for beginners to help them learn the Java language quickly without knowing the details of program structure such as modules and packages. In addition, JDK 9 also adds some other new features to make your development easier. For example, Reactive Streams API, collection factory methods, planned HTTP/2 Client API, Stack-Walking API, Platform Logging API and unified JVM logging. 2 System requirements for running the codeFirst, you need to downloadJigsaw is a sub-project under the OpenJDK project. It aims to design and implement a standard module system for the Java SE platform and apply it to the platform and JDK.
JDK 9 (Java Development Kit 9). You need to download it from this website JDK9. If you can't access it, you can use Download.
First you need to agree to the license agreement, and then you can download it. Java 9 can run on many platforms:. The same as the previous JDK configuration method. Here, I take macOS 10.12 version as an example, the configuration on Macbook. Here you will need some basic operations of vi, you can go online to find how to use it. After downloading the JDK, run it directly. Then the installation directory is: /library/Java/JavaVirtualMachines/jdk-9.jdk/
Under Terminal, enter the current directory of your user (it is your user’s default directory when you open it, I really don’t know Type cd
ls -a
command on the command line to list files or directories including hidden files in the current directory.
4. Find the .bash_profile file. This file will affect your current user's configuration information, and execute the
vi .bash_profile command to edit this file.
5. After entering the edit page, configure the Java Home and Path environment variables:
Configure Java environment variables
6. After configuring, use the esc key to exit the editing state, enter ":wq", save and exit. And execute . .bash_profile
to make the configuration file take effect immediately. Execute javac -version
on the command line. If the following information is output, it means the JDK configuration is correct.
At this point, the JDK configuration is complete.
If you want to compile and run Java programs, you need to install an integrated development environment (IDE) on your computer, such as NetBeans or Eclipse. No IDE currently fully supports the module system in JDK 9. However, NetBeans supports the creation of one module per NetBeans project. That is, if you want to create three Java modules in NetBeans, you need to create three NetBeans Java projects. A Java module can reference other Java modules using project dependencies in NetBeans. Currently, NetBeans does not support multi-module Java projects. The latest information about module system support in NetBeans can be found on the wiki page: .
You can download the latest NetBeans version that supports JDK 9 from the following link:. There are many NetBeans versions for us to download. For convenience, we download the "All" version directly.
At this point, the configuration of JDK 9 has been completed and NetBeans has been downloaded. The detailed configuration of NetBeans will be introduced in subsequent chapters.
The above is the detailed content of Getting started with Java 9. For more information, please follow other related articles on the PHP Chinese website!