java - Encapsulate excutable -


i have binary executable have source code in c++. need use in ways in java code. planing wrap class in java, code call class instead of calling executable directly. similar how .net wraps old com component. since new java, wondering if there better way solve it.

it depends on "certain ways" want use it.

if want call methods directly, (probably) need learn jni. there weird com <-> java things, or @ least there used be.

if want more or less "pipe" data , out of executable, similar unix commands, need @ runtime.exec(), or newer (and better) processbuilder. direct use of runtime.exec() challenging, so, if want, search libraries support it, or example code.

(edit added in response op's comment) running shell command, you'll want @ runtime.exec() or processbuilder. here links:

stack overflow discussion 1

stack overflow discussion 2

a javaworld discussion of pitfalls here


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -