Java Doc for SystemUtils.java in  » Library » Apache-common-lang » org » apache » commons » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common lang » org.apache.commons.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.lang.SystemUtils

SystemUtils
public class SystemUtils (Code)

Helpers for java.lang.System.

If a system property cannot be read due to security restrictions, the corresponding field in this class will be set to null and a message will be written to System.err.


author:
   Based on code from Avalon Excalibur
author:
   Based on code from Lucene
author:
   Stephen Colebourne
author:
   Steve Downey
author:
   Gary Gregory
author:
   Michael Becke
author:
   Tetsuya Kaneuchi
author:
   Rafal Krupinski
author:
   Jason Gritman
since:
   1.0
version:
   $Id: SystemUtils.java 437554 2006-08-28 06:21:41Z bayard $


Field Summary
final public static  StringAWT_TOOLKIT
    

The awt.toolkit System Property.

Holds a class name, on Windows XP this is sun.awt.windows.WToolkit.

On platforms without a GUI, this value is null.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringFILE_ENCODING
    

The file.encoding System Property.

File encoding, such as Cp1252.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringFILE_SEPARATOR
    

The file.separator System Property. File separator ("/" on UNIX).

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  booleanIS_JAVA_1_1
    
final public static  booleanIS_JAVA_1_2
    
final public static  booleanIS_JAVA_1_3
    
final public static  booleanIS_JAVA_1_4
    
final public static  booleanIS_JAVA_1_5
    
final public static  booleanIS_JAVA_1_6
    
final public static  booleanIS_OS_AIX
    
final public static  booleanIS_OS_HP_UX
    
final public static  booleanIS_OS_IRIX
    
final public static  booleanIS_OS_LINUX
    
final public static  booleanIS_OS_MAC
    
final public static  booleanIS_OS_MAC_OSX
    
final public static  booleanIS_OS_OS2
    
final public static  booleanIS_OS_SOLARIS
    
final public static  booleanIS_OS_SUN_OS
    
final public static  booleanIS_OS_UNIX
    
final public static  booleanIS_OS_WINDOWS
    
final public static  booleanIS_OS_WINDOWS_2000
    
final public static  booleanIS_OS_WINDOWS_95
    
final public static  booleanIS_OS_WINDOWS_98
    
final public static  booleanIS_OS_WINDOWS_ME
    
final public static  booleanIS_OS_WINDOWS_NT
    
final public static  booleanIS_OS_WINDOWS_XP
    
final public static  StringJAVA_AWT_FONTS
    

The java.awt.fonts System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringJAVA_AWT_GRAPHICSENV
    

The java.awt.graphicsenv System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringJAVA_AWT_HEADLESS
    

The java.awt.headless System Property. The value of this property is the String "true" or "false".

final public static  StringJAVA_AWT_PRINTERJOB
    

The java.awt.printerjob System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringJAVA_CLASS_PATH
    

The java.class.path System Property.

final public static  StringJAVA_CLASS_VERSION
    

The java.class.version System Property. Java class format version number.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded.

final public static  StringJAVA_COMPILER
    

The java.compiler System Property.

final public static  StringJAVA_ENDORSED_DIRS
    

The java.endorsed.dirs System Property.

final public static  StringJAVA_EXT_DIRS
    

The java.ext.dirs System Property.

final public static  StringJAVA_HOME
    

The java.home System Property.

final public static  StringJAVA_IO_TMPDIR
    

The java.io.tmpdir System Property.

final public static  StringJAVA_LIBRARY_PATH
    

The java.library.path System Property.

final public static  StringJAVA_RUNTIME_NAME
    

The java.runtime.name System Property.

final public static  StringJAVA_RUNTIME_VERSION
    

The java.runtime.version System Property.

final public static  StringJAVA_SPECIFICATION_NAME
    

The java.specification.name System Property.

final public static  StringJAVA_SPECIFICATION_VENDOR
    

The java.specification.vendor System Property.

final public static  StringJAVA_SPECIFICATION_VERSION
    

The java.specification.version System Property.

final public static  StringJAVA_UTIL_PREFS_PREFERENCES_FACTORY
    

The java.util.prefs.PreferencesFactory System Property.

final public static  StringJAVA_VENDOR
    

The java.vendor System Property.

final public static  StringJAVA_VENDOR_URL
    

The java.vendor.url System Property.

final public static  StringJAVA_VERSION
    

The java.version System Property.

final public static  floatJAVA_VERSION_FLOAT
    
final public static  intJAVA_VERSION_INT
    
final public static  StringJAVA_VERSION_TRIMMED
    
final public static  StringJAVA_VM_INFO
    

The java.vm.info System Property.

final public static  StringJAVA_VM_NAME
    

The java.vm.name System Property.

final public static  StringJAVA_VM_SPECIFICATION_NAME
    

The java.vm.specification.name System Property.

final public static  StringJAVA_VM_SPECIFICATION_VENDOR
    

The java.vm.specification.vendor System Property.

final public static  StringJAVA_VM_SPECIFICATION_VERSION
    

The java.vm.specification.version System Property.

final public static  StringJAVA_VM_VENDOR
    

The java.vm.vendor System Property.

final public static  StringJAVA_VM_VERSION
    

The java.vm.version System Property.

final public static  StringLINE_SEPARATOR
    

The line.separator System Property.

final public static  StringOS_ARCH
    

The os.arch System Property.

final public static  StringOS_NAME
    

The os.name System Property.

final public static  StringOS_VERSION
    

The os.version System Property.

final public static  StringPATH_SEPARATOR
    

The path.separator System Property.

final public static  StringUSER_COUNTRY
    

The user.country or user.region System Property. User's country code, such as GB.

final public static  StringUSER_DIR
    

The user.dir System Property.

final public static  StringUSER_HOME
    

The user.home System Property.

final public static  StringUSER_LANGUAGE
    

The user.language System Property.

final public static  StringUSER_NAME
    

The user.name System Property.

final public static  StringUSER_TIMEZONE
    

The user.timezone System Property.


Constructor Summary
public  SystemUtils()
    

SystemUtils instances should NOT be constructed in standard programming.


Method Summary
public static  FilegetJavaHome()
    
public static  FilegetJavaIoTmpDir()
    
public static  floatgetJavaVersion()
    
public static  FilegetUserDir()
    
public static  FilegetUserHome()
    
public static  booleanisJavaAwtHeadless()
     Returns whether the SystemUtils.JAVA_AWT_HEADLESS value is true.
public static  booleanisJavaVersionAtLeast(float requiredVersion)
    
public static  booleanisJavaVersionAtLeast(int requiredVersion)
    

Field Detail
AWT_TOOLKIT
final public static String AWT_TOOLKIT(Code)

The awt.toolkit System Property.

Holds a class name, on Windows XP this is sun.awt.windows.WToolkit.

On platforms without a GUI, this value is null.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1



FILE_ENCODING
final public static String FILE_ENCODING(Code)

The file.encoding System Property.

File encoding, such as Cp1252.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.2



FILE_SEPARATOR
final public static String FILE_SEPARATOR(Code)

The file.separator System Property. File separator ("/" on UNIX).

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



IS_JAVA_1_1
final public static boolean IS_JAVA_1_1(Code)

Is true if this is Java version 1.1 (also 1.1.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_JAVA_1_2
final public static boolean IS_JAVA_1_2(Code)

Is true if this is Java version 1.2 (also 1.2.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_JAVA_1_3
final public static boolean IS_JAVA_1_3(Code)

Is true if this is Java version 1.3 (also 1.3.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_JAVA_1_4
final public static boolean IS_JAVA_1_4(Code)

Is true if this is Java version 1.4 (also 1.4.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_JAVA_1_5
final public static boolean IS_JAVA_1_5(Code)

Is true if this is Java version 1.5 (also 1.5.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_JAVA_1_6
final public static boolean IS_JAVA_1_6(Code)

Is true if this is Java version 1.6 (also 1.6.x versions).

The field will return false if SystemUtils.JAVA_VERSION is null.




IS_OS_AIX
final public static boolean IS_OS_AIX(Code)

Is true if this is AIX.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_HP_UX
final public static boolean IS_OS_HP_UX(Code)

Is true if this is HP-UX.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_IRIX
final public static boolean IS_OS_IRIX(Code)

Is true if this is Irix.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_LINUX
final public static boolean IS_OS_LINUX(Code)

Is true if this is Linux.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_MAC
final public static boolean IS_OS_MAC(Code)

Is true if this is Mac.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_MAC_OSX
final public static boolean IS_OS_MAC_OSX(Code)

Is true if this is Mac.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_OS2
final public static boolean IS_OS_OS2(Code)

Is true if this is OS/2.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_SOLARIS
final public static boolean IS_OS_SOLARIS(Code)

Is true if this is Solaris.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_SUN_OS
final public static boolean IS_OS_SUN_OS(Code)

Is true if this is SunOS.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_UNIX
final public static boolean IS_OS_UNIX(Code)

Is true if this is a POSIX compilant system, as in any of AIX, HP-UX, Irix, Linux, MacOSX, Solaris or SUN OS.

The field will return false if OS_NAME is null.


since:
   2.1



IS_OS_WINDOWS
final public static boolean IS_OS_WINDOWS(Code)

Is true if this is Windows.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_2000
final public static boolean IS_OS_WINDOWS_2000(Code)

Is true if this is Windows 2000.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_95
final public static boolean IS_OS_WINDOWS_95(Code)

Is true if this is Windows 95.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_98
final public static boolean IS_OS_WINDOWS_98(Code)

Is true if this is Windows 98.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_ME
final public static boolean IS_OS_WINDOWS_ME(Code)

Is true if this is Windows ME.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_NT
final public static boolean IS_OS_WINDOWS_NT(Code)

Is true if this is Windows NT.

The field will return false if OS_NAME is null.


since:
   2.0



IS_OS_WINDOWS_XP
final public static boolean IS_OS_WINDOWS_XP(Code)

Is true if this is Windows XP.

The field will return false if OS_NAME is null.


since:
   2.0



JAVA_AWT_FONTS
final public static String JAVA_AWT_FONTS(Code)

The java.awt.fonts System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1



JAVA_AWT_GRAPHICSENV
final public static String JAVA_AWT_GRAPHICSENV(Code)

The java.awt.graphicsenv System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1



JAVA_AWT_HEADLESS
final public static String JAVA_AWT_HEADLESS(Code)

The java.awt.headless System Property. The value of this property is the String "true" or "false".

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


See Also:   SystemUtils.isJavaAwtHeadless()
since:
   2.1
since:
   Java 1.4



JAVA_AWT_PRINTERJOB
final public static String JAVA_AWT_PRINTERJOB(Code)

The java.awt.printerjob System Property.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1



JAVA_CLASS_PATH
final public static String JAVA_CLASS_PATH(Code)

The java.class.path System Property. Java class path.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_CLASS_VERSION
final public static String JAVA_CLASS_VERSION(Code)

The java.class.version System Property. Java class format version number.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_COMPILER
final public static String JAVA_COMPILER(Code)

The java.compiler System Property. Name of JIT compiler to use. First in JDK version 1.2. Not used in Sun JDKs after 1.2.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2. Not used in Sun versions after 1.2.



JAVA_ENDORSED_DIRS
final public static String JAVA_ENDORSED_DIRS(Code)

The java.endorsed.dirs System Property. Path of endorsed directory or directories.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.4



JAVA_EXT_DIRS
final public static String JAVA_EXT_DIRS(Code)

The java.ext.dirs System Property. Path of extension directory or directories.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.3



JAVA_HOME
final public static String JAVA_HOME(Code)

The java.home System Property. Java installation directory.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_IO_TMPDIR
final public static String JAVA_IO_TMPDIR(Code)

The java.io.tmpdir System Property. Default temp file path.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_LIBRARY_PATH
final public static String JAVA_LIBRARY_PATH(Code)

The java.library.path System Property. List of paths to search when loading libraries.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_RUNTIME_NAME
final public static String JAVA_RUNTIME_NAME(Code)

The java.runtime.name System Property. Java Runtime Environment name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.3



JAVA_RUNTIME_VERSION
final public static String JAVA_RUNTIME_VERSION(Code)

The java.runtime.version System Property. Java Runtime Environment version.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.3



JAVA_SPECIFICATION_NAME
final public static String JAVA_SPECIFICATION_NAME(Code)

The java.specification.name System Property. Java Runtime Environment specification name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_SPECIFICATION_VENDOR
final public static String JAVA_SPECIFICATION_VENDOR(Code)

The java.specification.vendor System Property. Java Runtime Environment specification vendor.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_SPECIFICATION_VERSION
final public static String JAVA_SPECIFICATION_VERSION(Code)

The java.specification.version System Property. Java Runtime Environment specification version.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.3



JAVA_UTIL_PREFS_PREFERENCES_FACTORY
final public static String JAVA_UTIL_PREFS_PREFERENCES_FACTORY(Code)

The java.util.prefs.PreferencesFactory System Property. A class name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1
since:
   Java 1.4



JAVA_VENDOR
final public static String JAVA_VENDOR(Code)

The java.vendor System Property. Java vendor-specific string.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_VENDOR_URL
final public static String JAVA_VENDOR_URL(Code)

The java.vendor.url System Property. Java vendor URL.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_VERSION
final public static String JAVA_VERSION(Code)

The java.version System Property. Java version number.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



JAVA_VERSION_FLOAT
final public static float JAVA_VERSION_FLOAT(Code)

Gets the Java version as a float.

Example return values:

  • 1.2f for JDK 1.2
  • 1.31f for JDK 1.3.1

The field will return zero if SystemUtils.JAVA_VERSION is null.


since:
   2.0



JAVA_VERSION_INT
final public static int JAVA_VERSION_INT(Code)

Gets the Java version as an int.

Example return values:

  • 120 for JDK 1.2
  • 131 for JDK 1.3.1

The field will return zero if SystemUtils.JAVA_VERSION is null.


since:
   2.0



JAVA_VERSION_TRIMMED
final public static String JAVA_VERSION_TRIMMED(Code)

Gets the Java version as a String trimming leading letters.

The field will return null if SystemUtils.JAVA_VERSION is null.


since:
   2.1



JAVA_VM_INFO
final public static String JAVA_VM_INFO(Code)

The java.vm.info System Property. Java Virtual Machine implementation info.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.2



JAVA_VM_NAME
final public static String JAVA_VM_NAME(Code)

The java.vm.name System Property. Java Virtual Machine implementation name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_VM_SPECIFICATION_NAME
final public static String JAVA_VM_SPECIFICATION_NAME(Code)

The java.vm.specification.name System Property. Java Virtual Machine specification name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_VM_SPECIFICATION_VENDOR
final public static String JAVA_VM_SPECIFICATION_VENDOR(Code)

The java.vm.specification.vendor System Property. Java Virtual Machine specification vendor.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_VM_SPECIFICATION_VERSION
final public static String JAVA_VM_SPECIFICATION_VERSION(Code)

The java.vm.specification.version System Property. Java Virtual Machine specification version.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_VM_VENDOR
final public static String JAVA_VM_VENDOR(Code)

The java.vm.vendor System Property. Java Virtual Machine implementation vendor.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



JAVA_VM_VERSION
final public static String JAVA_VM_VERSION(Code)

The java.vm.version System Property. Java Virtual Machine implementation version.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.2



LINE_SEPARATOR
final public static String LINE_SEPARATOR(Code)

The line.separator System Property. Line separator ("\n" on UNIX).

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



OS_ARCH
final public static String OS_ARCH(Code)

The os.arch System Property. Operating system architecture.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



OS_NAME
final public static String OS_NAME(Code)

The os.name System Property. Operating system name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



OS_VERSION
final public static String OS_VERSION(Code)

The os.version System Property. Operating system version.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



PATH_SEPARATOR
final public static String PATH_SEPARATOR(Code)

The path.separator System Property. Path separator (":" on UNIX).

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



USER_COUNTRY
final public static String USER_COUNTRY(Code)

The user.country or user.region System Property. User's country code, such as GB. First in JDK version 1.2 as user.region. Renamed to user.country in 1.4

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.2



USER_DIR
final public static String USER_DIR(Code)

The user.dir System Property. User's current working directory.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



USER_HOME
final public static String USER_HOME(Code)

The user.home System Property. User's home directory.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



USER_LANGUAGE
final public static String USER_LANGUAGE(Code)

The user.language System Property. User's language code, such as "en".

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.0
since:
   Java 1.2



USER_NAME
final public static String USER_NAME(Code)

The user.name System Property. User's account name.

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   Java 1.1



USER_TIMEZONE
final public static String USER_TIMEZONE(Code)

The user.timezone System Property. For example: "America/Los_Angeles".

Defaults to null if the runtime does not have security access to read this property or the property does not exist.

This value is initialized when the class is loaded. If System.setProperty(StringString) or System.setProperties(java.util.Properties) is called after this class is loaded, the value will be out of sync with that System property.


since:
   2.1




Constructor Detail
SystemUtils
public SystemUtils()(Code)

SystemUtils instances should NOT be constructed in standard programming. Instead, the class should be used as SystemUtils.FILE_SEPARATOR.

This constructor is public to permit tools that require a JavaBean instance to operate.





Method Detail
getJavaHome
public static File getJavaHome()(Code)

Gets the Java home directory as a File.

a directory
throws:
  SecurityException - if a security manager exists and its checkPropertyAccess method doesn't allowaccess to the specified system property.
See Also:   System.getProperty(String)
since:
   2.1



getJavaIoTmpDir
public static File getJavaIoTmpDir()(Code)

Gets the Java IO temporary directory as a File.

a directory
throws:
  SecurityException - if a security manager exists and its checkPropertyAccess method doesn't allowaccess to the specified system property.
See Also:   System.getProperty(String)
since:
   2.1



getJavaVersion
public static float getJavaVersion()(Code)

Gets the Java version number as a float.

Example return values:

  • 1.2f for JDK 1.2
  • 1.31f for JDK 1.3.1
the version, for example 1.31f for JDK 1.3.1SystemUtils.JAVA_VERSION_FLOAT



getUserDir
public static File getUserDir()(Code)

Gets the user directory as a File.

a directory
throws:
  SecurityException - if a security manager exists and its checkPropertyAccess method doesn't allowaccess to the specified system property.
See Also:   System.getProperty(String)
since:
   2.1



getUserHome
public static File getUserHome()(Code)

Gets the user home directory as a File.

a directory
throws:
  SecurityException - if a security manager exists and its checkPropertyAccess method doesn't allowaccess to the specified system property.
See Also:   System.getProperty(String)
since:
   2.1



isJavaAwtHeadless
public static boolean isJavaAwtHeadless()(Code)
Returns whether the SystemUtils.JAVA_AWT_HEADLESS value is true. true if JAVA_AWT_HEADLESS is "true",false otherwise.
See Also:   SystemUtils.JAVA_AWT_HEADLESS
since:
   2.1
since:
   Java 1.4



isJavaVersionAtLeast
public static boolean isJavaVersionAtLeast(float requiredVersion)(Code)

Is the Java version at least the requested version.

Example input:

  • 1.2f to test for JDK 1.2
  • 1.31f to test for JDK 1.3.1

Parameters:
  requiredVersion - the required version, for example 1.31f true if the actual version is equal or greaterthan the required version



isJavaVersionAtLeast
public static boolean isJavaVersionAtLeast(int requiredVersion)(Code)

Is the Java version at least the requested version.

Example input:

  • 120 to test for JDK 1.2 or greater
  • 131 to test for JDK 1.3.1 or greater

Parameters:
  requiredVersion - the required version, for example 131 true if the actual version is equal or greaterthan the required version
since:
   2.0



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.