在Windows 7上为JNI_CreateJavaVM链接到哪个库? [英] What library to link to on Windows 7 for JNI_CreateJavaVM?

查看:486
本文介绍了在Windows 7上为JNI_CreateJavaVM链接到哪个库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C ++构建JNI应用程序的第一个工作版本。我不相信应用程序的具体细节对于这个问题很重要。如果是,我会追加它们。

I am building a first working version of a JNI application in C++. I do not believe the specific details of the application are important for this question. If they are, I will append them.

我的代码编译没有错误。但是,有一个链接器错误:

My code compiles without error. However, there is a single linker error:

error LNK2019: unresolved external symbol __imp__JNI_CreateJavaVM@12

我知道 JNI_CreateJavaVM 不包含在 jvm中。 lib / jvm.dll 。但是,我无法确定我需要链接到此函数的库。

I understand that JNI_CreateJavaVM is not included in jvm.lib / jvm.dll. However, I cannot determine what library I do need to link to for this function.

我安装了JDK(但只有64位 - 这是一个32位的C ++应用程序,可能是相关的。)

I have JDK installed (but only 64-bit - and this is a 32-bit C++ application, which may be relevant).

有人可以帮忙吗?

推荐答案

在Visual Studio中将jvm.lib链接到项目的步骤:

Steps to link the jvm.lib to your project in Visual Studio:


  • 右键单击项目 - > properties。

  • 在Properties对话框中,在
    Linker-> Input-> AdditionalDependencies区域下添加jvm.lib。

  • 最后在

    Linker-> General下编写jvm.lib路径(如C:\Program

    Files \ Java @ \\ _ddk1.7.0_60 \ lib) - > AdditionalLibraryDirectories

完成这些步骤后,您的项目可以链接到jvm并且运行良好。

After those steps, your project can link to jvm and work well.

这篇关于在Windows 7上为JNI_CreateJavaVM链接到哪个库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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