Developing JNI DLL libraries in Visual Studio

Source: Internet
Author: User

The Visual Studio Library is rarely used for development, and this time it is less efficient to develop with common tools because of a larger requirement, so choose to use Visual Studio for development as follows: Open Visual Studio, select File-> New-> project, select Win32 Project, enter the name of the project, and then click OK, as shown below
Click Next to go to the application settings interface, select DLL and Empty project, and finally click Finish, as shown
To enable the DLL library to access JNI-related header and library files, right-click on the project name and select Properties, as shown below

Popup Project Properties page, as shown below

In the Project Properties page, click Configure properties and select VC + + directory, as shown below

Click Include directory, and select Edit, as shown below

Click Edit to eject the Include Directory dialog box, where the Include directory in the JDK installation directory is included, click OK, as shown

Also, click Reference Directory, select Edit, eject the Reference Directory dialog box, include the Lib directory in the JDK installation directory in the dialog box, click OK, as shown below

When the project properties are configured, click the OK button on the Project property page to exit the Project property page.

Take the JNI header file into the project's header file directory and edit the implementation file in the source file directory, as shown below

Finally, the DLL file is generated, as shown below

The steps above will complete the process of developing the JNI DLL library in Visual Studio and completing the compilation of the 32-bit DLL library. If Java wants to call a 64-bit DLL library, it needs to be configured as follows, select Configuration Manager in the following figure

In the Configuration Manager interface that pops up, click the figure below to select New

To configure the new solution platform that pops up in the following figure, click OK

Set up a 64-bit platform for your project in the Configuration Manager interface and click Close to exit, as shown in the following figure

Finally, rebuild the DLL library for the project, as shown below

That is all the steps in Visual Studio to complete the development of the JNI DLL library and compile it into a 32-bit or 63-bit library.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.