zoukankan      html  css  js  c++  java
  • 不同系统与程序修改java.library.path的位置(转)

    原文地址:http://blog.csdn.net/quqibing001/article/details/51201768

    Linux环境

    系统变量LD_LIBRARY_PATH来添加Java.library.path

    Windows

    在系统->高级系统设置->环境变量里,在path变量里添加。

    Eclipse

    在Properties -> Run/Debug settings -> Arguments->VM arguments里添加:

    -Djava.library.path=/home/abc/workspace/
    

    IntelliJ Idea

    Run/Debug Configurations的VM Options里添加:

    -Djava.library.path=/home/abc/workspace/
    

    程序动态添加

    private static void loadJNILibDynamically() {
            try {
                System.setProperty("java.library.path", System.getProperty("java.library.path")
                        + ":/home/abc/workspace/");
                Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
                fieldSysPath.setAccessible(true);
                fieldSysPath.set(null, null);
                //C++动态链接库 JNIC
                System.loadLibrary("JNIC");
            } catch (Exception e) {
                // do nothing for exception
            }
    }
    
  • 相关阅读:
    jsp实现登陆功能小实验
    netty
    shiro
    mybatis
    spring MVC
    spring
    集合框架面试题
    Redis面试题
    Dubbo面试题汇总
    阿里面试题
  • 原文地址:https://www.cnblogs.com/huiy/p/6293056.html
Copyright © 2011-2022 走看看