In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the pits of Java CPP". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what are the pits of Java CPP.
1. Make it clear that the System.load and System.loadLibrarySystem.load//System.load parameters must be the absolute path of the library file, which can be any path, such as: System.load ("C:\\ Documents and Settings\\ TestJNI.dll"); / / Windows System.load ("/ usr/lib/TestJNI.so"); / / the LinuxSystem.loadLibrary//System.loadLibrary parameter is the library file name and does not include the extension of the library file. System.loadLibrary ("TestJNI"); / load TestJNI.dll native library System.loadLibrary ("TestJNI") under Windows; / / load libTestJNI.so native library under Linux / / Note: TestJNI.dll or libTestJNI.so must be in the path pointed to by the JVM attribute java.library.path. 12312342. The above is the principle (it doesn't work! ) GlobalFunction.getSingleton (). LoadJNILibrary ("zlprint"); loadJNILibrary this method is automatically from the classpath or jar package to find zlprint.dll or zlprint.so (depending on the OS system platform) repeatedly loading the same dll will report an error! LoadJNILibrary wants to distinguish between x86 and x64. Suppose you have the same two zlprint.dll, please add the directory qualified name before it, such as the pit of windows-x86_64/zlprint123.JavaCPP.
When executing these command lines, you need to run them from the command prompt of Visual Studio 20XX.
$javac-cp javacpp.jar NativeLibrary.java
$java-jar javacpp.jar NativeLibrary
$java-cp javacpp.jar NativeLibrary
Because the last line of command calls VS's runtime compiler cl.exe, you can't find it if you execute it in the Visual Studio x64 Win64 Command Prompt (2010) command!
If the xxx.java file you write contains package information, you should put the xxx.class file in the package directory before you can compile (this is java common sense)
The annotations in JavaCPP annotation are all for C++ file generation, and have nothing to do with the java file itself!
The function exists to configure the generated cpp code
@ Platform (include= "PrintLib.h", link = "D:/javacpp-bin/zlprint")
The header file contains include= {"PrintLib.h", "string.h"}
Thank you for your reading, the above is the content of "what is the pit of Java CPP?" after the study of this article, I believe you have a deeper understanding of what the pit of Java CPP has, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.