Java outputs JVM and OS related attributes ZZ

Source: Internet
Author: User
Tags file separator

It mainly uses the properties class in the util package provided by Java. Let's talk about the Code:

View plaincopy to clipboardprint?
Import java. util .*;

Public class yourjavaproperties {
Public static void main (string ARGs []) {
Properties props = system. getproperties ();

System. Out. println ("Java Runtime Environment version:" + props. getproperty ("Java. Version "));
System. Out. println ("Java Runtime Environment vendor:" + props. getproperty ("Java. Vendor "));
System. Out. println ("Java vendor URL:" + props. getproperty ("Java. Vendor. url "));
System. Out. println ("Java installation path:" + props. getproperty ("Java. Home "));
System. Out. println ("Java Virtual Machine standard version:" + props. getproperty ("Java. VM. Specification. Version "));
System. Out. println ("Java virtual machine specification vendor:" + props. getproperty ("Java. VM. Specification. Vendor "));
System. Out. println ("Java virtual machine specification name:" + props. getproperty ("Java. VM. Specification. Name "));
System. Out. println ("Java Virtual Machine implementation version:" + props. getproperty ("Java. VM. Version "));
System. Out. println ("Java Virtual Machine implementation vendor:" + props. getproperty ("Java. VM. Vendor "));
System. Out. println ("Java Virtual Machine implementation name:" + props. getproperty ("Java. VM. Name "));
System. Out. println ("Java Runtime Environment Standard Version:" + props. getproperty ("Java. Specification. Version "));
System. Out. println ("Java Runtime Environment specification vendor:" + props. getproperty ("Java. Specification. Vender "));
System. Out. println ("Java Runtime Environment Standard name:" + props. getproperty ("Java. Specification. Name "));
System. Out. println ("Java class format version:" + props. getproperty ("Java. Class. Version "));
System. Out. println ("Java class path:" + props. getproperty ("Java. Class. Path "));
System. Out. println ("List of paths searched during Database loading:" + props. getproperty ("Java. Library. Path "));
System. Out. println ("Default temporary file path:" + props. getproperty ("Java. Io. tmpdir "));
System. Out. println ("path of one or more extension directories:" + props. getproperty ("Java. Ext. dirs "));
System. Out. println ("operating system name:" + props. getproperty ("OS. Name "));
System. Out. println ("Operating System Architecture:" + props. getproperty ("OS. Arch "));
System. Out. println ("OS version:" + props. getproperty ("OS. Version "));
System. Out. println ("file separator:" + props. getproperty ("file. separator"); // "/" in UNIX "/"
System. Out. println ("path separator:" + props. getproperty ("path. separator"); // ":" in UNIX ":"
System. Out. println ("line separator:" + props. getproperty ("line. separator"); // "/n" in UNIX"
System. Out. println ("user's Account name:" + props. getproperty ("user. Name "));
System. Out. println ("user's home directory:" + props. getproperty ("user. Home "));
System. Out. println ("current working directory of the User:" + props. getproperty ("user. dir "));
}
}
Import java. util .*;

Public class yourjavaproperties {
Public static void main (string ARGs []) {
Properties props = system. getproperties ();

System. Out. println ("Java Runtime Environment version:" + props. getproperty ("Java. Version "));
System. Out. println ("Java Runtime Environment vendor:" + props. getproperty ("Java. Vendor "));
System. Out. println ("Java vendor URL:" + props. getproperty ("Java. Vendor. url "));
System. Out. println ("Java installation path:" + props. getproperty ("Java. Home "));
System. Out. println ("Java Virtual Machine standard version:" + props. getproperty ("Java. VM. Specification. Version "));
System. Out. println ("Java virtual machine specification vendor:" + props. getproperty ("Java. VM. Specification. Vendor "));
System. Out. println ("Java virtual machine specification name:" + props. getproperty ("Java. VM. Specification. Name "));
System. Out. println ("Java Virtual Machine implementation version:" + props. getproperty ("Java. VM. Version "));
System. Out. println ("Java Virtual Machine implementation vendor:" + props. getproperty ("Java. VM. Vendor "));
System. Out. println ("Java Virtual Machine implementation name:" + props. getproperty ("Java. VM. Name "));
System. Out. println ("Java Runtime Environment Standard Version:" + props. getproperty ("Java. Specification. Version "));
System. Out. println ("Java Runtime Environment specification vendor:" + props. getproperty ("Java. Specification. Vender "));
System. Out. println ("Java Runtime Environment Standard name:" + props. getproperty ("Java. Specification. Name "));
System. Out. println ("Java class format version:" + props. getproperty ("Java. Class. Version "));
System. Out. println ("Java class path:" + props. getproperty ("Java. Class. Path "));
System. Out. println ("List of paths searched during Database loading:" + props. getproperty ("Java. Library. Path "));
System. Out. println ("Default temporary file path:" + props. getproperty ("Java. Io. tmpdir "));
System. Out. println ("path of one or more extension directories:" + props. getproperty ("Java. Ext. dirs "));
System. Out. println ("operating system name:" + props. getproperty ("OS. Name "));
System. Out. println ("Operating System Architecture:" + props. getproperty ("OS. Arch "));
System. Out. println ("OS version:" + props. getproperty ("OS. Version "));
System. Out. println ("file separator:" + props. getproperty ("file. separator"); // "/" in UNIX "/"
System. Out. println ("path separator:" + props. getproperty ("path. separator"); // ":" in UNIX ":"
System. Out. println ("line separator:" + props. getproperty ("line. separator"); // "/n" in UNIX"
System. Out. println ("user's Account name:" + props. getproperty ("user. Name "));
System. Out. println ("user's home directory:" + props. getproperty ("user. Home "));
System. Out. println ("current working directory of the User:" + props. getproperty ("user. dir "));
}
}

The output is as follows. Pay attention to the output line separator...

View plaincopy to clipboardprint?
Java Runtime Environment version: 1.6.0 _ 15
Java Runtime Environment vendor: Sun Microsystems Inc.
Java vendor URL: http://java.sun.com/
Java installation path: C:/Java/jre6
Java Virtual Machine Specification Version: 1.0
Java virtual machine specification Supplier: Sun Microsystems Inc.
Java virtual machine specification name: Java virtual machine specification
Java Virtual Machine implementation version: 14.1-B02
Java Virtual Machine implementation vendor: Sun Microsystems Inc.
Java Virtual Machine implementation name: Java hotspot (TM) Client VM
Java Runtime Environment Standard Version: 1.6
Java Runtime Environment specification vendor: NULL
Java Runtime Environment specification name: Java platform API Specification
Java version: 50.0
Java class path: C:/Java-Justin/Ds; D:/program files/Eclipse/plugins/cpdetector. Jar
List of paths searched during Library Loading: C:/Java/jre6/bin ;.; c:/Windows/Sun/Java/bin; C:/Windows/system32; C:/windows; C:/Java/jre6/bin/client; C: /Java/jre6/bin; C:/Windows/system32; C:/windows; C:/Windows/system32/WBEM; C:/program files/ATI Technologies/Ati. ACE/Core-static; D:/program files/Borland/silktest/
Default temporary file path: C:/docume ~ 1/Justin ~ 1/locals ~ 1/temp/
Path of one or more extension directories: C:/Java/jre6/lib/EXT; C:/Windows/Sun/Java/lib/EXT
Operating system name: Windows XP
Operating System Architecture: x86
OS Version: 5.1
File separator :/
Path separator :;
Line separator:

User Account name: Justin & Avril
User's home directory: C:/Documents ents and settings/Justin & Avril
User's current working directory: C:/Java-Justin/DS
Java Runtime Environment version: 1.6.0 _ 15
Java Runtime Environment vendor: Sun Microsystems Inc.
Java vendor URL: http://java.sun.com/
Java installation path: C:/Java/jre6
Java Virtual Machine Specification Version: 1.0
Java virtual machine specification Supplier: Sun Microsystems Inc.
Java virtual machine specification name: Java virtual machine specification
Java Virtual Machine implementation version: 14.1-B02
Java Virtual Machine implementation vendor: Sun Microsystems Inc.
Java Virtual Machine implementation name: Java hotspot (TM) Client VM
Java Runtime Environment Standard Version: 1.6
Java Runtime Environment specification vendor: NULL
Java Runtime Environment specification name: Java platform API Specification
Java version: 50.0
Java class path: C:/Java-Justin/Ds; D:/program files/Eclipse/plugins/cpdetector. Jar
List of paths searched during Library Loading: C:/Java/jre6/bin ;.; c:/Windows/Sun/Java/bin; C:/Windows/system32; C:/windows; C:/Java/jre6/bin/client; C: /Java/jre6/bin; C:/Windows/system32; C:/windows; C:/Windows/system32/WBEM; C:/program files/ATI Technologies/Ati. ACE/Core-static; D:/program files/Borland/silktest/
Default temporary file path: C:/docume ~ 1/Justin ~ 1/locals ~ 1/temp/
Path of one or more extension directories: C:/Java/jre6/lib/EXT; C:/Windows/Sun/Java/lib/EXT
Operating system name: Windows XP
Operating System Architecture: x86
OS Version: 5.1
File separator :/
Path separator :;
Line separator:

User Account name: Justin & Avril
User's home directory: C:/Documents ents and settings/Justin & Avril
User's current working directory: C:/Java-Justin/DS

Related Article

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.