Home> Java> javaTutorial> body text

How to get Java and OS version and vendor details in JShell in Java 9?

WBOY
Release: 2023-09-09 12:17:02
forward
1342 people have browsed it

在Java 9中如何在JShell中获取Java和操作系统版本以及供应商详细信息?

Java 9 introduces theJShelltool for the Java programming language. This tool allows us to evaluate code snippets such asdeclarations,statementsandexpressions. We will get details aboutJava VersionandVendorand get details aboutOS VersionandNameusing static Method:getProperty()of theSystemclass.

In the following code snippet, we can get the details Java version, Java vendor and OS version and OS name in JShell console.

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!