在win平台上Eclipse中启动Tomcat时,报如下错误,原因是 java.library.path中找不到Tomcat的tcnative-1.dll库,才会报出The APR based Apache Tomcat Native library not found
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_20\jre\bin...
只需配置下环境变量即可,java.library.path的查找路径为系统的环境变量Path路径,而tcnative-1.dll文件在Tomcat的bin目录下,设置下面的PATH变量即可:
set PATH CATALINA_HOME=D:\soft\apache-tomcat-6.0.41 PATH=%PATH%;%CATALINA_HOME%/bin
Java查找的class类是通过CLASSPATH设置,查找外部的dll或者so模块则通过 用户级参数java.library.path 来加载,不管是Linux还是win平台,都可以通过System.getProperties()来查看Java运行环境参数
public static void main(String[] args) { // TODO Auto-generated method stub Properties p = System.getProperties(); Set keys = p.keySet(); for(Object key: keys){ System.out.println(key.toString() + " : " + p.getProperty(key.toString())); } }
加载非class模块可以从下面两个方法进行加载
1.启动的时候添加参数 java -Djava.library.path=PATH 2.在代码中架在你 System.load(PATH)
时间: 2024-10-18 19:47:50