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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。