java system類
系統類mapLibraryName()方法 (System class mapLibraryName() method)
mapLibraryName() method is available in java.lang package.
mapLibraryName()方法在java.lang包中可用。
mapLibraryName() method is used to map a given library name into a platform-dependent native library name. This is a universal method for mapping a library name into the platform-specific name.
mapLibraryName()方法用于將給定的庫名稱映射到依賴于平臺的本機庫名稱。 這是將庫名稱映射到特定于平臺的名稱的通用方法。
mapLibraryName() method is static a method, it is accessible with the class name too.
mapLibraryName()方法是靜態方法,也可以使用類名進行訪問。
mapLibraryName() method may throw an exception at the time of library name mapping: NullPointerException: In this exception if the mapped library name is null.
在庫名映射時, mapLibraryName()方法可能會引發異常:NullPointerException:如果映射的庫名為null,則在此異常中。
Syntax:
句法:
public static String mapLibraryName(String library_name);
Parameter(s):
參數:
String library_name – represents the name of the library.
字符串library_name –代表庫的名稱。
Return value:
返回值:
The return type of this method is String, it returns the mapped the given the library name.
該方法的返回類型為String ,它返回給定庫名稱的映射。
Example:
例:
// Java program to demonstrate the example of
// mapLibraryName() method of System Class
public class MapLibraryNameMethod {
public static void main(String[] args) {
// Display the version of operating system
System.out.println(System.getProperty("os.version"));
// Here, we are calling the mapLibraryName() method
// that will be used to map a library name (os.version)
// into a platform-specific string representing a native library
String s = System.mapLibraryName("os.version");
System.out.println(s);
}
}
Output
輸出量
E:\Programs>javac MapLibraryNameMethod.java
E:\Programs>java MapLibraryNameMethod
4.8.0-41-generic
libos.version.so
翻譯自: https://www.includehelp.com/java/system-class-maplibraryname-method-with-example.aspx
java system類