Class SystemUtils
- java.lang.Object
-
- org.apache.maven.plugins.javadoc.SystemUtils
-
class SystemUtils extends java.lang.ObjectContains several OS-specific methods from Commons-Lang3's SystemUtils. We don't want to use that class because it uses enums for Java versions, which implies that with every new Java version a new commons-lang3 is required.- Since:
- 3.0.1
-
-
Field Summary
Fields Modifier and Type Field Description static booleanIS_OS_AIXIstrueif this is AIX.static booleanIS_OS_MAC_OSXIstrueif this is Mac.static booleanIS_OS_WINDOWSIstrueif this is Windows.private static java.lang.StringJAVA_HOME_KEYThe System property key for the Java home directory.static java.lang.StringLINE_SEPARATORTheline.separatorSystem Property.static java.lang.StringOS_NAMETheos.nameSystem Property.private static java.lang.StringOS_NAME_WINDOWS_PREFIXThe prefix String for all Windows OS.
-
Constructor Summary
Constructors Constructor Description SystemUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.FilegetJavaHome()Gets the Java home directory as aFile.private static booleangetOSMatchesName(java.lang.String osNamePrefix)Decides if the operating system matches.private static java.lang.StringgetSystemProperty(java.lang.String property)Gets a System property, defaulting tonullif the property cannot be read.(package private) static booleanisOSNameMatch(java.lang.String osName, java.lang.String osNamePrefix)Decides if the operating system matches.
-
-
-
Field Detail
-
OS_NAME
public static final java.lang.String OS_NAME
The
os.nameSystem Property. Operating system name.Defaults to
nullif 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(String,String)orSystem.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_WINDOWS_PREFIX
private static final java.lang.String OS_NAME_WINDOWS_PREFIX
The prefix String for all Windows OS.- See Also:
- Constant Field Values
-
IS_OS_AIX
public static final boolean IS_OS_AIX
Is
trueif this is AIX.The field will return
falseifOS_NAMEisnull.
-
IS_OS_MAC_OSX
public static final boolean IS_OS_MAC_OSX
Is
trueif this is Mac.The field will return
falseifOS_NAMEisnull.
-
IS_OS_WINDOWS
public static final boolean IS_OS_WINDOWS
Is
trueif this is Windows.The field will return
falseifOS_NAMEisnull.
-
JAVA_HOME_KEY
private static final java.lang.String JAVA_HOME_KEY
The System property key for the Java home directory.- See Also:
- Constant Field Values
-
LINE_SEPARATOR
public static final java.lang.String LINE_SEPARATOR
The
line.separatorSystem Property. Line separator ("\n"on UNIX).Defaults to
nullif 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(String,String)orSystem.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
-
-
Method Detail
-
getOSMatchesName
private static boolean getOSMatchesName(java.lang.String osNamePrefix)
Decides if the operating system matches.- Parameters:
osNamePrefix- the prefix for the os name- Returns:
- true if matches, or false if not or can't determine
-
isOSNameMatch
static boolean isOSNameMatch(java.lang.String osName, java.lang.String osNamePrefix)Decides if the operating system matches.This method is package private instead of private to support unit test invocation.
- Parameters:
osName- the actual OS nameosNamePrefix- the prefix for the expected OS name- Returns:
- true if matches, or false if not or can't determine
-
getJavaHome
public static java.io.File getJavaHome()
Gets the Java home directory as a
File.- Returns:
- a directory
- Throws:
java.lang.SecurityException- if a security manager exists and itscheckPropertyAccessmethod doesn't allow access to the specified system property.- Since:
- 2.1
- See Also:
System.getProperty(String)
-
getSystemProperty
private static java.lang.String getSystemProperty(java.lang.String property)
Gets a System property, defaulting to
nullif the property cannot be read.If a
SecurityExceptionis caught, the return value isnulland a message is written toSystem.err.- Parameters:
property- the system property name- Returns:
- the system property value or
nullif a security problem occurs
-
-