Java ClassLoader findLibrary()方法与示例
ClassLoader类findLibrary()方法 (ClassLoader Class findLibrary() method)
findLibrary() method is available in java.lang package.
findLibrary()方法在java.lang包中可用。
findLibrary() method is used to find the absolute pathname of the given native library.
findLibrary()方法用于查找给定本机库的绝对路径名。
findLibrary() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
findLibrary()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
findLibrary() method does not throw an exception at the time of returning the absolute path of the given library.
返回给定库的绝对路径时, findLibrary()方法不会引发异常。
Syntax:
句法:
protected String findLibrary(String lib_name);
Parameter(s):
参数:
String lib_name – represents the name of the library.
字符串lib_name –代表库的名称。
Return value:
返回值:
The return type of this method is String, it returns an absolute path of the given library.
该方法的返回类型为String ,它返回给定库的绝对路径。
Note: It returns null when JVM finds the library along the path given as the system property "java.library.path"
注意:当JVM沿着系统属性“ java.library.path”给出的路径找到库时,它将返回null。
Example:
例:
// Java program to demonstrate the example
// of String findLibrary(String lib_name) method of ClassLoader
class FindLibrary extends ClassLoader {// Override findLibrary() of ClassLoader
protected String findLibrary(String lib_name) {if (lib_name.equals("java.lang")) {}
return lib_name;
}
}
public class Main {public static void main(String[] args) throws Exception {// Creating an instance of FindLibrary
FindLibrary fl = new FindLibrary();
// we are finding the library java.lang and it returns
// it already exists in Java
String library = fl.findLibrary("java.lang");
System.out.println("Library Found: " + library);
}
}
Output
输出量
Library Found: java.lang
翻译自: https://www.includehelp.com/java/classloader-findlibrary-method-with-example.aspx
Java ClassLoader findLibrary()方法与示例相关推荐
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java getresources方法_Java ClassLoader getResources()方法与示例
ClassLoader类getResources()方法getResources()方法在java.lang包中可用. getResources()方法用于标识具有给定资源名称的所有资源. getRe ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
- java exec waitfor,Java Process waitFor()方法与示例
流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...
- java arraylist.add(),Java ArrayList add()方法与示例
ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...
最新文章
- 【毕业求职季】-听说你想去大厂看学妹,教你京东软件产品经理面试如何一把过
- 趣味图解编程算法,文科生都看懂了
- 照片识别出错_2.GQI2021强电专业点式专业图元识别连载
- windows环境下python 虚拟环境的创建和使用(virtualenvwrapper)
- asp.net中条件查询+分页
- 为啥用redis解决会话呢?
- 用Python爬取Bilibili视频,难吗?
- ftp 425 Can't open data connection. 的解决方案
- html网页简单代码
- Solidity教程:初学Solidity
- 西门子PLC编写抢答系统
- 艺不压身和艺多不养家
- yolov3-tiny原始weights模型转onnx模型并进行推理
- UE4-音效触发技巧
- ORACLE函数库大全
- CentOS搭建代理服务器
- 解决win10蓝牙自动断连
- 开源方言分词转换软件Chinese dialect convert诞生了
- C语言 两个整数的四则运算
- ChatGPT首批88个插件最全解读