zoukankan      html  css  js  c++  java
  • System.LoadLibrary 规格严格

    System.loadLibary()

    http://dikar.iteye.com/category/23294

    http://blog.csdn.net/zhangao0086/article/details/6395002
    http://cab0605.iteye.com/blog/154701 

    The parameter to System.loadLibrary() should be the name of the libary, without path, extension or "lib":

    1System.loadLibrary("payment");

    Depending on your platform, this will load libpayment.so or payment.dll.

    Although it is not an error to call System.loadLibrary() multiple times, loading the libraries is often done in a static code block:

    1class Test {
    2    static {
    3        System.loadLibrary("payment");
    4    }
    5}

    java.library.path

    Java searches several directories for this libary file. The directories to search are specified in the property java.library.path. On Linux, this is a copy of the environment variable LD_LIBRARY_PATH. On Windows, it is a copy of the PATH variable.

    Although changing the java.library.path has influence on how Java loads its libraries, it has no effect on Windows. When your library depends on other DLLs, these are loaded without taking java.library.path into account. If the library you load needs another library, which can not be found, you get an UnsatisfiedLinkError with the message "Can't find dependent libraries". To solve this, you can load the dependant libraries yourself using multiple calls to System.loadLibrary(), loading all libaries one by one.

    When the library can not be found, you get a java.lang.UnsatisfiedLinkError with the message "no library in java.library.path". To solve this, move the library in one of the directories specified by java.library.path or alter the property so that it points to the directory containing your library. (read how to do this in Maven). You can print this property with the following code:

    1System.out.println(System.getProperty("java.library.path"));

    Method decoration

    Another possibility when things do not work is when the DLL can be found, but the methods can not. A DLL exports functions according to specific names an calling conventions. When your compiler is not configured the right way your methods may get another name than they should be. To solve this, you should include the header file generated by javah and configure your compiler the right way (read about stdcall in MinGW, calling conventions).

  • 相关阅读:
    Vue源码学习之双向绑定
    Vue源码学习之数据初始化
    JavaScript跨域资源请求(CORS)解决方案
    Vue学习笔记
    MongoDB学习笔记
    实现一个类似bootstrap的多级下拉菜单
    bootstrap栅格系统的实现
    滑动效果的标签页切换
    一个简单的类似Vue的双向绑定
    元素垂直居中的常见方法
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/2160538.html
Copyright © 2011-2022 走看看