如何通过vc ++ 2008调用Java类并传递/返回值 [英] How to call java class and pass/return values through vc++ 2008

查看:51
本文介绍了如何通过vc ++ 2008调用Java类并传递/返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试代码时,我已经尝试过如何使用JNI通过AJalilqarshi从C调用Java函数",出现以下错误:

 1> VC_JAVA.obj:警告LNK4248:"_ jmethodID"的未解析的typeref令牌(0100000F);图像可能无法运行
1> VC_JAVA.obj:错误LNK2028:未解析的令牌(0A000011)外部" C长__stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)"(?JNI_CreateJavaVM @@ $$ J212YGJPAPAUJavaVM _ @@ PAPAXPAX @ Z)在函数"struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)"中引用(?create_vm @@ $$ FYAPAUJNIEnv _ @@ PAPAUJavaVM _ @@@ Z)
1> VC_JAVA.obj:错误LNK2019:未解析的外部符号"extern"C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)(?JNI_CreateJavaVM @@ $$ J212YGJPAPAUJavaVM _ @@ PAPAXPAX @ Z)函数"struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)"(?create_vm @@ $$ FYAPAUJNIEnv _ @@ PAPAUJavaVM _ @@@ Z)
1> C:\ Documents and Settings \ 372577 \ My Documents \ Visual Studio 2008 \ Projects \ VC_JAVA \ Debug \ VC_JAVA.exe:致命错误LNK1120:2无法解析的外部
1>构建日志保存在文件://c:\ Documents and Settings \ 372577 \ My Documents \ Visual Studio 2008 \ Projects \ VC_JAVA \ Debug \ BuildLog.htm"
1> VC_JAVA-3个错误,1个警告



当我使用jdk1.6.0_23版本时.我需要将jdk 1.6更改为此版本吗?
谢谢

解决方案

J212YGJPAPAUJavaVM _ @@@ PAPAXPAX @ Z)在函数"struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)"中引用(?create_vm @@

FYAPAUJNIEnv _ @@ PAPAUJavaVM _ @@@ Z) 1> VC_JAVA.obj:错误LNK2019:未解决的外部符号"extern"C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)(?JNI_CreateJavaVM @@


函数"struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)"中引用的J212YGJPAPAUJavaVM _ @@ PAPAXPAX @ Z(?create_vm @@


I have already tried "How to Call Java Functions from C Using JNI By ajalilqarshi" when i tried the code i got the following errors:

1>VC_JAVA.obj : warning LNK4248: unresolved typeref token (0100000F) for '_jmethodID'; image may not run
1>VC_JAVA.obj : error LNK2028: unresolved token (0A000011) "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" (?JNI_CreateJavaVM@@$$J212YGJPAPAUJavaVM_@@PAPAXPAX@Z) referenced in function "struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)" (?create_vm@@$$FYAPAUJNIEnv_@@PAPAUJavaVM_@@@Z)
1>VC_JAVA.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" (?JNI_CreateJavaVM@@$$J212YGJPAPAUJavaVM_@@PAPAXPAX@Z) referenced in function "struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)" (?create_vm@@$$FYAPAUJNIEnv_@@PAPAUJavaVM_@@@Z)
1>C:\Documents and Settings\372577\My Documents\Visual Studio 2008\Projects\VC_JAVA\Debug\VC_JAVA.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\372577\My Documents\Visual Studio 2008\Projects\VC_JAVA\Debug\BuildLog.htm"
1>VC_JAVA - 3 error(s), 1 warning(s)



While i am using jdk1.6.0_23 version. Do i need to change jdk 1.6 to this version?
Thank you

解决方案

J212YGJPAPAUJavaVM_@@PAPAXPAX@Z) referenced in function "struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)" (?create_vm@@


FYAPAUJNIEnv_@@PAPAUJavaVM_@@@Z) 1>VC_JAVA.obj : error LNK2019: unresolved external symbol "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" (?JNI_CreateJavaVM@@


J212YGJPAPAUJavaVM_@@PAPAXPAX@Z) referenced in function "struct JNIEnv_ * __cdecl create_vm(struct JavaVM_ * *)" (?create_vm@@


这篇关于如何通过vc ++ 2008调用Java类并传递/返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆