四川科技馆智能控制Java物联网AI开发
1.分清楚System.load与System.loadLibrary
System.load // System.load 参数必须为库文件的绝对路径,可以是任意路径,例如:System.load("C:\\Documents and Settings\\TestJNI.dll"); //Windows System.load("/usr/lib/TestJNI.so"); //LinuxSystem.loadLibrary //System.loadLibrary 参数为库文件名,不包含库文件的扩展名。System.loadLibrary ("TestJNI"); //加载Windows下的TestJNI.dll本地库 System.loadLibrary ("TestJNI"); //加载Linux下的libTestJNI.so本地库 //注意:TestJNI.dll 或 libTestJNI.so 必须是在JVM属性java.library.path所指向的路径中。
2.以上为原理(都不好使!!!)
GlobalFunction.getSingleton().loadJNILibrary("zlprint");
loadJNILibrary
这个炸天方法是自动从classpath或者jar包中寻找 zlprint.dll 或者 zlprint.so(具体根据OS系统平台决定)
重复加载相同的dll会报错哦!
loadJNILibrary要区分x86和x64,假设你有相同的两个zlprint.dll,请在前面加上目录限定名称,比如:windows-x86_64/zlprint
3.JavaCPP的坑
执行这些命令行的时候需要在Visual Studio 20XX的命令提示

本文探讨了在Java中实现物联网AI数据采集与智能控制的方法,重点关注了JavaCPP库的使用,强调了在使用System.load与System.loadLibrary时的注意事项,以及在Visual Studio环境下编译JavaCPP的坑,包括必须在特定命令提示符下运行和处理包含package的java文件。文章还提到了JavaCPP注解的作用和配置cpp代码的重要性,并提供了更多控制系统的学习资源。
最低0.47元/天 解锁文章
1896

被折叠的 条评论
为什么被折叠?



