Reputation: 575
I want to use some .cpp
class and methods in my java program. For example, I have p1.java
that calls method1
. method1
is available in p2.cpp
and p2.cpp
includes p3.cpp
. I don't want to change cpp codes...
Is it possible? (and I need .cpp
and .header
both.)
And is there any alternative better solution? (except java native interface)?
Upvotes: 0
Views: 115
Reputation: 36
Why don't you create an extra layer between Java and C++ with JNI - effectively you create:
method1_java_cpp_layer( JNIEnv * e, jobject o )
{
extracted_information = extract_information( e, o );
method1( extracted_information )
}
And this goes into "java_cpp_layer.cpp".
Upvotes: 2