Supercharge Your Innovation With Domain-Expert AI Agents!

Method for conveniently calling DLL through Java

A convenient, code-based technology, applied in the field of operating systems, can solve problems such as cumbersome initialization methods, and achieve the effects of improving work efficiency, enhancing ease of use, and reducing code redundancy.

Active Publication Date: 2017-12-15
GUANGZHOU HUIRUI SITONG INFORMATION SCI & TECH CO LTD
View PDF1 Cites 4 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The purpose of the present invention is to solve the problem that JNative calls the third-party DLL to pre-write the cumbersome initialization method to realize the interface, and provides a convenient method for Java to call the DLL. This method only needs to dynamically compile and call the interface according to the interface

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for conveniently calling DLL through Java

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0053]The invention discloses a method for calling a DLL using the Java language under the environment of the windows operating system, and the specific process steps are as attached figure 1 As shown, the process is as follows:

[0054] Step S1, based on the Windows operating system, and the Java development environment Jdk, Eclipse, etc. are installed;

[0055] Step S2, having a JAVA project, creating or importing an existing project;

[0056] Step S3, download JNative Jar package and DLL on the Internet;

[0057] Step S4, import JNative.jar into the Java project, and copy JNativeCpp.dll to the Windows\System32 directory;

[0058] Step S5, write the Java interface class according to the third-party DLL dynamic library function;

[0059] In the prior art, a third-party DLL dynamic library function has a function name of CRC16 (length, ptr), and the function of this function is to calculate a data body to obtain a check code. The function has two parameters, namely length ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for conveniently calling a DLL through Java. The method comprises the following steps that on the basis of the dynamic library, a Java interface class and a reflection interface class are compiled; according to function information (a function name, a return value and a parameter list) obtained by the reflection interface class, dynamic files are compiled; the dynamic files are written into a physical file; the dynamic physical file is compiled; the dynamic physical file and instantiation are reflected; an interface is obtained and returned. According to the method, only dynamic call compiling is needed according to the interface to obtain the interface, compared with a traditional JNative calling mode, the method is easier and more convenient to use, the usability is enhanced, the working efficiency is improved, code redundancy and coupling are lowered, and the object-oriented programming ideology of the Java can be embodied in a more appropriate mode.

Description

technical field [0001] The invention relates to the technical field of operating systems, in particular to a convenient method for calling a DLL by Java under the environment of a windows operating system. Background technique [0002] At present, the common methods of calling DLL in Java generally include JNI, JNA, JNative, etc. The differences between these methods are as follows: JNI is used by many people, but it is relatively troublesome. It is necessary to be familiar with C language and use Javac and Javah commands, and the steps are cumbersome; JNA and JNative only need to implement the interface, which is simpler and more convenient than JNI ; When JNative calls the third-party DLL, it needs to pre-write the cumbersome initialization method to realize the interface, which will be the problem that needs to be solved urgently. Contents of the invention [0003] The purpose of the present invention is to solve the problem that JNative calls a third-party DLL to pre-...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/44G06F9/45
CPCG06F8/315G06F8/443
Inventor 李家威
Owner GUANGZHOU HUIRUI SITONG INFORMATION SCI & TECH CO LTD
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More