Abhishek
Abhishek

Reputation: 49

Calling C++ executable from JAVA

I have poker bot written in C++. I want to compete it with another Poker Academy agent. In order to do that there is an API in JAVA namely "meerkat api".

I have no idea how to call my c++ executable from java api, how does one go about communicating with the independent c++ executable from within a java package?

Upvotes: 1

Views: 1050

Answers (3)

Jiri Kremser
Jiri Kremser

Reputation: 12837

Or if you need to integrate with the C++ app on lower lvl meaning not only "run a program and process the results". You can use the JNI or easier variant JNA, but I have to admit it is pain.

Upvotes: 1

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

After reading/following @hmjd, Well you can use DefaultExecutor from Apache Commons Exec library to execute commands but it internally uses java.lang.Runtime and java.lang.Process.

I would suggest you to use this library over Runtime because Apache Command Execution APIs are more sophisticated, and provide all and more features than Java Runtime. It also handles exit Values.

Upvotes: 0

hmjd
hmjd

Reputation: 121971

To get started see:

Upvotes: 4

Related Questions