2

I would like to call a c++ program from java application, packaged in a jar file. Is it possible to package and call c++ from the jar file? Thanks

kem
  • 407
  • 1
  • 6
  • 20

1 Answers1

2

Calling C++ functions from Java, you need read about JNI.

The exported C++ functions will store in dynamic libraries such as .dll(Windows) or .so(Linux) files.

Then try to package that .dll file into the jar file (Read this).

Community
  • 1
  • 1
masoud
  • 55,379
  • 16
  • 141
  • 208
  • Actually, you can package so's and dll's in JARs and Java can even load them with JNI! Here's some info on it http://stackoverflow.com/questions/11578903/package-dll-in-jar-using-maven-single-goal – Jon7 Apr 08 '13 at 18:28
  • The C++ program is command line app with input + args and the generated output will be parsed by a java class. I want to deploy the c++ program packaged in a jar file with the java app. – kem Apr 11 '13 at 19:49