Java to get Java information through code, such as virtual machine, version, PATH, etc.

Source: Internet
Author: User

Package Com.itm.path;public class testsystemproperty{public static void Main (string[] args) {System.out.println ("Ja    VA runtime Environment version: \ n "+system.getproperty (" java.version "));    System.out.println ("Java Runtime Environment vendor: \ n" +system.getproperty ("Java.vendor"));    System.out.println ("Url:\n of Java Vendor" +system.getproperty ("Java.vendor.url"));    System.out.println ("Java installation directory: \ n" +system.getproperty ("Java.home"));    System.out.println ("Java Virtual machine specification version: \ n" +system.getproperty ("java.vm.specification.version"));    System.out.println ("Java class format version number: \ n" +system.getproperty ("java.class.version"));    System.out.println ("Java classpath: \ n" +system.getproperty ("Java.class.path"));    SYSTEM.OUT.PRINTLN ("List of paths searched when loading library: \ n" +system.getproperty ("Java.library.path"));    SYSTEM.OUT.PRINTLN ("Default temporary file path: \ n" +system.getproperty ("Java.io.tmpdir"));    System.out.println ("Name of the JIT compiler to use: \ n" +system.getproperty ("Java.compiler"));    SYSTEM.OUT.PRINTLN ("Path to one or more extended directories: \ n" +system.getproperty ("Java.ext.dirs")); System.out.println ("Name of the operating system: \ n"+system.getproperty (" Os.name "));    SYSTEM.OUT.PRINTLN ("Architecture of the operating system: \ n" +system.getproperty ("Os.arch"));    SYSTEM.OUT.PRINTLN ("OS version: \ n" +system.getproperty ("os.version"));    System.out.println ("File delimiter (in UNIX system is"/"): \ n" +system.getproperty ("File.separator"));    SYSTEM.OUT.PRINTLN ("Path delimiter (in UNIX system is": "): \ n" +system.getproperty ("Path.separator"));    SYSTEM.OUT.PRINTLN ("The line delimiter (in UNIX system is"/n "): \ n" +system.getproperty ("Line.separator"));    System.out.println ("User's account name: \ n" +system.getproperty ("User.Name"));    System.out.println ("User's home directory: \ n" +system.getproperty ("User.home"));    System.out.println ("User's current working directory: \ n" +system.getproperty ("User.dir")); System.out.println ("uri notation for the absolute path of the current classpath:---->>: \ n" + thread.currentthread (). Getcontextclassloader ().    GetResource ("")); System.out.println ("Gets the URI directory of the current class Filetest.class file. Don't include yourself!    : \ n "+testsystemproperty.class.getresource (")); System.out.println ("Gets the absolute URI path of the current classpath.    : \ n "+ TestSystemproperty.class.getResource ("/")); }}

  

Java to get Java information through code, such as virtual machine, version, PATH, etc.

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.