Java SE 9 (JDK9) Environment installation and interactive programming environment Jshell example, jdk9jshell

Source: Internet
Author: User

Java SE 9 (JDK9) Environment installation and interactive programming environment Jshell example, jdk9jshell
Purpose

Install JDK 9 and use the Jshell tool to experience the interactive Java programming environment.

What is Jshell?

It is actually a command line tool. After JDK 9 is installed, you can find the tool in the bin directory, which is very similar to the Python interpreter, people who have used Python interpreters should be very familiar with it.

It allows you to experience interactive programming and has some interesting features:

1. The semicolon can be omitted at the end of the statement.

2. Generally, it is not necessary to forcibly capture the checked exceptions.

3. You can directly write an expression.

4. other methods or variables can be referenced when defining methods, and these methods or variables can be defined after a period of time;

5. Others

Install JDK 9 and download

You can download the following link:

Https://jdk9.java.net/download/

Http://down.downun.com/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/java/

I downloaded jdk-9-ea0000140_windows-x64_bin.exe;

Install

Very simple, click Install directly, remember to check the custom, select a suitable installation path, I installed in D: \ ProgramFiles \ Java \ jdk-9

Set Environment Variables

You can configure JAVA_HOME, PATH, CLASSPATH or something on the internet. If you only want to try Jshell, you can also choose not to set it;

Use Jshell

Directly under the binfile folder of the JDK installation directory, double-click jshell.exe.

Create a class and call a static method

Note that you can directly run the program without writing the main method.

Other examples

Enter/help for help

Did you find that it is very similar to the Python interpreter? You may want to explore the rest.

References

Http://www.importnew.com/16353.html

Http://www.journaldev.com/9879/java9-install-and-repl-jshell-tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.