首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >intellij内部出现未满足的链接错误

intellij内部出现未满足的链接错误
EN

Stack Overflow用户
提问于 2017-04-30 15:42:56
回答 1查看 600关注 0票数 1

我正在使用JNI (Java-Native-Interface)访问一些用c++编写的代码。当我从命令行运行代码时,一切正常,但是当我将代码添加到我的Intellij项目(类、头文件和dll)中时,它给出以下错误:

代码语言:javascript
复制
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Robin\Desktop\egdb_example\end.dll: Can't find dependent libraries

我的Java代码如下所示:

代码语言:javascript
复制
public class EndGame {

    public static native void openDataBase(int maxPieces, int buffer);

    public static native void test();

    public static native int lookUp(int condition, int BP, int WP, int K, int color);

    public static native void close();

    static {

        System.load("C:\\Users\\Robin\\Desktop\\egdb_example\\end.dll");

    }

    public static void main(String[] args) {

        System.out.println("Kleiner Test");
        openDataBase(8, 2000);
        int value = lookUp(0, 0, 0, 0, 0);
        close();
    }

}

运行这段代码时,我检查了路径是否正确

代码语言:javascript
复制
File test = new File("C:\\Users\\Robin\\Desktop\\egdb_example");

        for (File file : test.listFiles()){
            System.out.println(file.getName());
        }

这会产生结果:

代码语言:javascript
复制
.git
.gitattributes
.gitignore
egdb.h
egdb.lib
egdb64.dll
egdb64.lib
egdb_example.cpp
egdb_example.vcxproj
egdb_example.vcxproj.filters
end.dll
EndGame.class
EndGame.h
EndGame.java
jni.h
jni_md.h
main.cpp
Readme.pdf
robin.cpp
robin.exe

会非常感谢任何人的帮助

EN

回答 1

Stack Overflow用户

发布于 2017-04-30 20:57:39

看看这里,看看如何设置IntelliJ和CLion来调试代码。

http://jnicookbook.owsiak.org/recipe-No-D002/

如果您不使用CLion,只需跳过该部分,只看一看IntelliJ配置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43704134

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档