Java System Class 的 mapLibraryName() 方法將庫名稱映射到表示本機庫的特定於平台的字符串。
用法
public static String mapLibraryName(String libname)
參數
libname- Library 的名字。
返回
- 返回依賴於平台的本機庫名稱。
- 如果 libname 為 null,則返回 NullPointerException。
例子1
public class SystemMapLibraryNameExample1 {
public static void main(String[] args) {
System.out.println("map library for user's name = "+System.mapLibraryName("user.name"));
System.out.println("map library for user's home = "+System.mapLibraryName("user.home"));
System.out.println(System.mapLibraryName("map library for user's dir = "+"user.dir"));
}
}
輸出:
map library for user's name = user.name.dll map library for user's home = user.home.dll map library for user's dir = user.dir.dll
例子2
public class SystemMpaLibraryNameExample2 {
public static void main(String[] args) {
System.out.println("map library for OS's name = "+System.mapLibraryName("os.name"));
System.out.println("map library for OS's architecture = "+System.mapLibraryName("os.arch"));
System.out.println("map library for OS's version = "+System.mapLibraryName("os.version"));
}
}
輸出:
map library for OS's name = os.name.dll map library for OS's architecture = os.arch.dll map library for OS's version = os.version.dll
相關用法
- Java System clearProperty()用法及代碼示例
- Java System loadLibrary()用法及代碼示例
- Java System console()用法及代碼示例
- Java System arraycopy()用法及代碼示例
- Java System exit()用法及代碼示例
- Java System getProperty()用法及代碼示例
- Java System setIn()用法及代碼示例
- Java System nanoTime()用法及代碼示例
- Java System getenv()用法及代碼示例
- Java System setErr()用法及代碼示例
- Java System identityHashCode()用法及代碼示例
- Java System inheritedChannel()用法及代碼示例
- Java System load()用法及代碼示例
- Java System setOut()用法及代碼示例
- Java System lineSeparator()用法及代碼示例
- Java System setSecurityManager()用法及代碼示例
- Java System getSecurityManager()用法及代碼示例
- Java System getProperties()用法及代碼示例
- Java System gc()用法及代碼示例
- Java System setProperties()用法及代碼示例
注:本文由純淨天空篩選整理自 Java System mapLibraryName() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。