Java 9 introduces the JShell tool for the Java programming language. This tool allows us to evaluate code snippets such as declarations, statements and expressions. We will get details about Java Version and Vendor and get details about OS Version and Name using static Method: getProperty() of the System class.
In the following code snippet, we can get the details Java version, Java vendor and OS version and OS name in JShell console.
<strong>C:\Users\User>jshell | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> System.out.println(System.getProperty("java.version")); 9.0.4 jshell> System.out.println(System.getProperty("java.vendor")); Oracle Corporation jshell> System.out.println(System.getProperty("os.version")); 6.3 jshell> System.out.println(System.getProperty("os.name")); Windows 8.1 jshell></strong>
The above is the detailed content of How to get Java and OS version and vendor details in JShell in Java 9?. For more information, please follow other related articles on the PHP Chinese website!