Discussion Locked

How to call C++ function/program in java

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I try to use c++ program/function in my java program but I don't know how to call them in java. Besides, I don't know how to put them in a pacakge under different directory and call them on my working directory.

5 replies

by manoj_u_99

any c++ or c functions can be called in java using the native keyword.
the necessary header files have to be included and the function can be used with the native keyword.
i hope the answer satisfies ur need.

by iceblast

you can use the "native" keyword.

since u say u cannot locate the file if put in the different folder, then try this Runtime method:

public void load(String filename)

note that uhv to hv privileged to perform this operation.

hope this help solving your problem.

This discussion is closed to new replies.