- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get Java and OS version, vendor details in JShell in Java 9?
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 the details about Java Version and Vendor, and also get the details about OS Version and Name by using the static method: getProperty() of System class.
In the below code snippet, we can able to get the details of 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>
Advertisements