[英]Create a Java library (jar) from C code
Greetings, 问候,
I am trying to use this api: http://code.google.com/p/vavi-sensor/ 我正在尝试使用此API: http : //code.google.com/p/vavi-sensor/
for using the macbook accelerometer in Java code. 在Java代码中使用macbook加速度计。
I am put the .c files into my library but I am still getting a java.lang.UnsatisfiedLinkError: no SmsWrapper in java.library.path
我把.c文件放到我的库中,但我仍然得到一个java.lang.UnsatisfiedLinkError: no SmsWrapper in java.library.path
I assume this is because it's still in .c files while all my other libraries are .jar. 我认为这是因为它仍然在.c文件中,而我所有的其他库都是.jar。 How can I go about getting this into a jar or other loadable format (jnilib, etc)? 我怎么能把它变成罐子或其他可加载的格式(jnilib等)? thanks 谢谢
The .c files are just source code. .c文件只是源代码。 You need them compiled for the appropriate machine, packaged into a shared object library, and then referenced by native methods in a wrapper Java class. 您需要为适当的机器编译它们,打包到共享对象库中,然后在包装器Java类中由本机方法引用。
The JNI tutorial has all the information you'll need, although it doesn't go into detail about the non-Java side of things as most people doing this already know about programming in C and building shared object libraries. JNI教程提供了您需要的所有信息,虽然它没有详细介绍非Java方面的内容,因为大多数人这样做已经知道用C编程和构建共享对象库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.