Running Environment of JavaCookbook-2.Java

Source: Internet
Author: User
Tags dname

Java runtime depends on the runtime environment. You can use System to understand the running status of the System. In addition, there are Java. lang. system and Java. awt. Toolkit classes. Obtain the environment variable. The code is System. out. println (System. getenv ("PATH "));. This statement can only be used in the environment where the license is obtained. It is not applicable to the restricted environment (applet ). The method for obtaining System properties is System. getPropertie () or System. getProperties (). The default value can be set for the previous method. Note that the System class has a static Properties member whose content includes the operating System attributes. You can use the java-dname = valueclassname method to append the system property value during Java compilation. [Html] D: \ www.gongqingkui.cn \ javaCookbook \ bin> java-Dname = zzz p2_1 System. getProperty ("java. specification. version "): 1.6 System. getProperty ("name"): zzz uses System. getProperties (). list (System. out); All system properties can be listed. The result of the local operation on Windows xp is: [html] view plaincopy -- listingproperties -- java. runtime. name = Java (TM) SE Runtime Environment sun. boot. library. path = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 \ bin java. vm. version = 10.0 -B19 java. vm. vendor = SunMicrosystems Inc. java. vendor. url = http://java.sun.com/path. separator =; java. vm. name = JavaHotSpot (TM) Client VM file. encoding. pkg = sun. io user. country = CN sun. java. launcher = SUN_STANDARD sun. OS. patch. level = ServicePack 3 java. vm. specification. name = JavaVirtual Machine Specification user. dir = D: \ www.gongqingkui.cn \ javaCookbook java. runtime. version = 1.6.0 _ 04-b12 java. awt. graphicsenv = s Un. awt. win32GraphicsEnvironment java. endorsed. dirs = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 \ lib... OS. arch = x86 java. io. tmpdir = C: \ w.e ~ 1 \ ADMINI ~ 1. WWW \ LOCALS ~ 1 \ Temp \ line. separator = java. vm. specification. vendor = SunMicrosystems Inc. user. variant = OS. name = WindowsXP sun. jnu. encoding = GBK java. library. path = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 \ bin... java. specification. name = JavaPlatform API Specification java. class. version = 50.0 sun. management. compiler = HotSpotClient Compiler OS. version = 5.1 user. home = C: \ Documentsand Settings \ Administrat... user. timezone = java. awt. p Rinterjob = sun. awt. windows. WPrinterJob file. encoding = UTF-8 java. specification. version = 1.6 user. name = gqk java. class. path = D: \ www.gongqingkui.cn \ javaCookbook \ bin java. vm. specification. version = 1.0 sun. arch. data. model = 32 java. home = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 java. specification. vendor = SunMicrosystems Inc. user. language = zh awt. toolkit = sun. awt. windows. WToolkit java.vm.info = mixedmode, sharing java. vers Ion = 1.6.0 _ 04 java. ext. dirs = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 \ lib... sun. boot. class. path = C: \ ProgramFiles \ Java \ jre1.6.0 _ 04 \ lib... java. vendor = SunMicrosystems Inc. file. separator = \ java. vendor. url. bug = http://java.sun.com/cgi-bin/bugreport... sun. cpu. endian = little www.2cto. comsun. io. unicode. encoding = UnicodeLittle sun. desktop = windows sun. cpu. isalist = compile JDK version-related code: Use Class. forName () to load the class files to be used. This test must be performed in the main program flow.. Compile the Code related to the operating system: Taking Unix and windows as examples, they are different in processing file delimiters. You can use static variables or encapsulated files to write cross-operating system code. When using the extension package or other API packages, place the code package under JDKHOME/jre/lib/ext.

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.