为了实现 C++ 调用 Java的函数,以下方法可供参考。https://www.xingdaili.com/browse.php?u=RDFxE%2Bw3stMHuV6Q%2BLJWhbnh4Fb4JxGnYdxt1UkqyGFlfDtFncjT9tbFhUZUE6%2BW26h1OWzBt06FC4GH6pS4VY6iXDkrt6DXpPJosrmDOfQVVzgDl7rvjPaA6LZFYMTgWo73wlSBrNr4G7M%3D&b=6
Use JNI Use Jace Use JunC++ion Use execl("java", "java", "-jar", "myprog.jar", NULL); Use execlp("java", "java", "-jar", "myprog.jar", (char *)0); Use system("java filename.jar"); Use popen("java -jar test.jar text1 text2", "r"); Use CreateProcess(...); Use JNA
I'm trying to call / execute a java jar from a C++ program. Here are the options I've found so far:
I'd like to use JNI, however I'm running into problems. ======================== Hello.cppI have a simple Hello.cpp class:
======================== CompileAnd when I try to compile with something like:
Note: I found "jni.h" in that folder, so I included it. I'm assuming that's the right spot, but I'm not certain I get a ton of errors ( see below ) |