The value of the 1.java System.getproperty () method can be obtained
Java.version |
Java Runtime Environment version |
Java.vendor |
Java Runtime Environment Vendor |
Java.vendor.url |
URLs for Java Vendors |
Java.home |
Java installation directory |
Java.vm.specification.version |
Java Virtual Machine spec version |
Java.vm.specification.vendor |
Java Virtual Machine Specification vendor |
Java.vm.specification.name |
Java Virtual Machine Specification name |
Java.vm.version |
Java Virtual Machine Implementation version |
Java.vm.vendor |
Java Virtual machine Implementation provider |
Java.vm.name |
Java Virtual Machine Implementation name |
Java.specification.version |
Java Runtime Environment Specification version |
Java.specification.vendor |
Java Runtime Environment Specification vendor |
Java.specification.name |
Java Runtime Environment Specification name |
Java.class.version |
Java Class format version number |
Java.class.path |
Java class path |
Java.library.path |
List of paths to search when loading libraries |
Java.io.tmpdir |
Default temporary file path |
Java.compiler |
The name of the JIT compiler to use |
Java.ext.dirs |
Path to one or more extended directories |
Os.name |
The name of the operating system |
Os.arch |
The architecture of the operating system |
Os.version |
Version of the operating system |
File.separator |
File delimiter (in UNIX system is "/") |
Path.separator |
Path separator (in UNIX system is ":") |
Line.separator |
Row delimiter (in UNIX system is "n") |
User.Name |
User's account name |
User.home |
User's home directory |
User.dir |
User's current working directory |
2.Java obtains system parameters via System.getproperties ()
Properties props=system.getproperties (); System Properties
SYSTEM.OUT.PRINTLN ("Java Operating Environment version:" +props.getproperty ("java.version"));
SYSTEM.OUT.PRINTLN ("Java Operating Environment provider:" +props.getproperty ("Java.vendor"));
System.out.println ("Java Vendor's URL:" +props.getproperty ("Java.vendor.url"));
System.out.println ("Java Installation path:" +props.getproperty ("Java.home"));
SYSTEM.OUT.PRINTLN ("Java Virtual machine spec 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 provider:" +props.getproperty ("Java.vm.vendor"));
SYSTEM.OUT.PRINTLN ("Java Virtual machine implementation name:" +props.getproperty ("Java.vm.name"));
System.out.println ("Java Runtime Environment Specification 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 Specification name:" +props.getproperty ("Java.specification.name"));
System.out.println ("Java Class format version number:" +props.getproperty ("java.class.version"));
System.out.println ("Java classpath:" +props.getproperty ("Java.class.path"));
SYSTEM.OUT.PRINTLN ("List of paths to search when loading library:" +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 extended directories:" +props.getproperty ("Java.ext.dirs"));
System.out.println ("The name of the operating system:" +props.getproperty ("Os.name"));
SYSTEM.OUT.PRINTLN ("Architecture of the Operating system:" +props.getproperty ("Os.arch"));
SYSTEM.OUT.PRINTLN ("Operating system version:" +props.getproperty ("os.version"));
System.out.println ("File separator:" +props.getproperty ("File.separator")); In the UNIX system is "/"
SYSTEM.OUT.PRINTLN ("Path separator:" +props.getproperty ("Path.separator")); In the UNIX system is the ":"
System.out.println ("line delimiter:" +props.getproperty ("Line.separator")); Is "n" on a UNIX system
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 ("User's current working directory:" +props.getproperty ("User.dir"));
3.
Writing applications accessed through a proxy in Java
This tip will tell you how to write a Java application that can access a Web server on the Internet through a proxy. Adding proxy support In a Java application requires a few extra lines of code and does not rely on any security "vulnerabilities."
The secret to combining Java and agents is to activate specific system properties during the Java runtime. These attributes are not written to the official file, but are esoteric in Java programmers as part of the Java legend. To support proxies, Java applications need to specify not only the information of the agent itself, but also the user information for authentication. Before you start using the Internet Protocol, you need to add the following lines of code to your program:
Notifies Java that you want to connect through an agent
System.getproperties (). Put ("Proxyset", "true");
Specify the server on which the agent resides
System.getproperties (). Put ("ProxyHost", "myproxymachinename");
//Specifies the port on which the agent listens
System.getproperties (). Put ("ProxyPort", "85");
Some agents require users to enter a user name and password before authorizing users to access the Internet. If you are using a Web
that is located within a firewall