简体   繁体   中英

Java shared library generated from C++ code

I'm trying to run C++ code in java using the java wrapper to generate such code, I've successfully generated all the code and implemented it in my code, but when I try to compile, I get an architecture error

Can't load this.dll (machine code=0x7) on a AMD 64-bit platform

I'm running java 1.8.0_022, the PC I'm running the code in is a Intel 64 bit platform and I've tried to run the code in a 64 bit AMD computer and get the same error

any help to run C++ code in java? Either to run it like this with a shared library or any other method

The typical solution to run C++ code in Java is with Java Native Interfaces (JNI)

https://docs.oracle.com/javase/8/docs/technotes/guides/jni/

You might also want to check SWIG that makes the C++/JNI integration much easier.

https://www.swig.org/Doc1.3/Java.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM