有人能帮我吗?任何答案都会有帮助。我是一个Windows。我有一个c代码和另一个java代码。我正在尝试编译和链接,但是它给了我这个错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: program10.convert(D)D
at program10.convert(Native Method)
at program10.printTable(program10.java:65)
at program10.main(program10.java:16)
I tried these two:
gcc -I/usr/java/jdk1.8.0_191/include/ -I/usr/java/jdk1. 8.0_191/include/win32 -shared -o libprogram10.so program10.o
gcc -I/usr/java/jdk1.8.0_131/include/ -I/usr/java/jdk1. 8.0_131/include/win32 -shared -o libprogram10.so program10.o
在我的电脑上,位置是:
C:\Program Files\Java\jdk1.8.0_191\include
这是我的代码:program10.java
import java.util.Scanner;
public class program10
{
static
{
System.loadLibrary("program10");
}
public native double convert(double f);
/*code here*/
}
public static void main(String args[])
{
/*code here*/
}
public int interface()
{
/*code here*/
}
public void printTable(int size)
{
/*code here*/
}
程序10.c
# include <jni.h>
#include <stdio.h>
#include "program10.h"
JNIEXPORT jdouble JNICALL Java_program10_convert(JNIEnv *env, jobject obj, jdouble n) {
/*code here*/
}
暂无答案!
目前还没有任何答案,快来回答吧!