如何在intelliJ Idea中设置java.library.path

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19308010/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 15:55:47  来源:igfitidea点击:

How to set the java.library.path in intelliJ Idea

javaintellij-ideajava-native-interfaceresin

提问by AKIWEB

Could anyone please help how do I solve this error:

任何人都可以请帮助我如何解决此错误:

Native code library failed to load.
java.lang.UnsatisfiedLinkError: no ts-jni in java.library.path

I am using IDEA IDE as a first time, and have been using Resin_4.0.37 as a server to test my work. As soon as I start my lcoal server in debug mode it stays for approximately 1-2 mins and then suddenly it drops down and get disconnected by giving me the above error.

我是第一次使用 IDEA IDE,并且一直使用 Resin_4.0.37 作为服务器来测试我的工作。一旦我在调试模式下启动我的 lcoal 服务器,它会停留大约 1-2 分钟,然后突然下降并通过给我上述错误而断开连接。

I have set my Windows environmental variable correctly; and have also did the following in my IDE intelliJ:

我已经正确设置了我的 Windows 环境变量;并且还在我的 IDE intelliJ 中执行了以下操作:

 FILE->Project Structure->set Global Libraries->a. Java path and b. Resin library path.

Can any one please suggest me, what am I doing wrong and how do I set native library in intelliJ IDEA to solve the mentioned error.

任何人都可以建议我,我做错了什么以及如何在 intelliJ IDEA 中设置本机库来解决上述错误。

Any help would be appreciated. Also do correct me if I am doing something wrong.

任何帮助,将不胜感激。如果我做错了什么,也请纠正我。

Thanks!

谢谢!

采纳答案by maba

If you run your program from IntelliJ then you can set the java.library.pathin the VM optionsinput field in the Run/Debug Configurationsdialog.

如果您从 IntelliJ 运行您的程序,那么您可以在对话框java.library.pathVM options输入字段中设置Run/Debug Configurations

enter image description here

enter image description here

Example:

例子:

-Djava.library.path="C:\path\to\where\the\jni\lib\is"

-Djava.library.path="C:\path\to\where\the\jni\lib\is"