How to get an include-path of jni.h that is able to be different ondifferent platforms.

J

junyoung

Hi,

Now, I am trying to get an include-path of jni.h file to use in my
Makefile.

However, there is some difficult thing for me because the absolute
path of the header file is different according to platforms.

in case of linux
$JAVA_HOME/include/linux

in case of macos
$JAVA_HOME/Headers/

in case of solaris
$JAVA_HOME/include

...... all different..


So....
Is there any simple way to know an absolute path of the header file in
Makefile?

thanks...
 
N

Nigel Wade

Hi,

Now, I am trying to get an include-path of jni.h file to use in my
Makefile.

However, there is some difficult thing for me because the absolute path
of the header file is different according to platforms.

in case of linux
$JAVA_HOME/include/linux

in case of macos
$JAVA_HOME/Headers/

in case of solaris
$JAVA_HOME/include

..... all different..


So....
Is there any simple way to know an absolute path of the header file in
Makefile?

No, in general there is no easy way to get makefiles to work cross-
platform. Typically you would have different targets with different
dependencies, and compiler/linker arguments, for each OS.

Even the structure of makefiles is not consistent across platforms.
Solaris make is quite different from GNU make, although you can install
GNU make on Solaris, which results in an easier life.
 
J

Jeff Higgins

junyoung said:
Hi,

Now, I am trying to get an include-path of jni.h file to use in my
Makefile.

However, there is some difficult thing for me because the absolute
path of the header file is different according to platforms.

So....
Is there any simple way to know an absolute path of the header file in
Makefile?

thanks...
Scratch simple and use CMake.

--
 
Joined
May 4, 2011
Messages
3
Reaction score
0
To compile the source code of job scheduler, I created the symbolic link for java:
ln-s / opt / java java
and another for perl
ln-s / opt / perl perl
But during the compilation, the command
make / make-scheduler
returns this error
cc1plus: error: scheduler / prod / LINKS / java / include: Not a file
make: *** [log.o] Error 1
and the command
make
returns this error LINKS / java / include: Not a file and / LINKS / java / include / linux: Not a file
There is a mistake when creating the link or what?
Should I add -I$JAVA_HOME/include/linux ?
Thank you
 
Joined
May 4, 2011
Messages
3
Reaction score
0
the directory / java / include does not exist, that is why the command make / make-scheduler generates an error.
I created manually the folders and I recompiled the project.
That's what the command returns this time

]make: « libxml2.a » est à jour.
make: « libxslt.a » est à jour.
g++ ... -c -g -MD -Wall -Wno-sign-compare -Wno-long-long -Wuninitialized -DNDEBUG -O2 -m32 -DMAKE_UBUNTU -Wno-deprecated -Wno-reorder -Wno-non-virtual-dtor ../java.cxx
In file included from ../java.cxx:37:0:
../z_com.h: In function ‘bool zschimmer::com::variant_is_empty(const zschimmer::com::Variant&)’:
../z_com.h:836:60: warning: suggest parentheses around ‘&&’ within ‘||’
../java.cxx: In member function ‘void zschimmer::javabridge::Vm::start()’:
../java.cxx:655:7: warning: suggest explicit braces to avoid ambiguous ‘else’
../java.cxx: In function ‘void zschimmer::javabridge::throw_java_ret(int, const std::string&, const std::string&)’:
../java.cxx:1147:14: error: ‘JNI_ENOMEM’ was not declared in this scope
../java.cxx:1148:14: error: ‘JNI_EEXIST’ was not declared in this scope
../java.cxx:1149:14: error: ‘JNI_EINVAL’ was not declared in this scope
../java.cxx: In member function ‘int zschimmer::javabridge::Method::int_call(__jobject*, const zschimmer::javabridge::parameter_list&) const’:
../java.cxx:2076:92: error: invalid conversion from ‘const jvalue*’ to ‘jvalue*’
../java.cxx:2076:92: error: initializing argument 3 of ‘jint _Jv_JNIEnv::CallIntMethodA(__jobject*, _jmethodID*, jvalue*)’
../java.cxx: In member function ‘__jobject* zschimmer::javabridge::Method::jobject_call(__jobject*, const zschimmer::javabridge::parameter_list&) const’:
../java.cxx:2132:99: error: invalid conversion from ‘const jvalue*’ to ‘jvalue*’
../java.cxx:2132:99: error: initializing argument 3 of ‘__jobject* _Jv_JNIEnv::CallObjectMethodA(__jobject*, _jmethodID*, jvalue*)’
../java.cxx: In member function ‘std::string zschimmer::javabridge::Method::string_call(__jobject*, const zschimmer::javabridge::parameter_list&) const’:
../java.cxx:2146:106: error: invalid conversion from ‘const jvalue*’ to ‘jvalue*’
../java.cxx:2146:106: error: initializing argument 3 of ‘__jobject* _Jv_JNIEnv::CallObjectMethodA(__jobject*, _jmethodID*, jvalue*)’
../java.cxx: In member function ‘int zschimmer::javabridge::Static_method::int_call(__jclass*, const zschimmer::javabridge::parameter_list&) const’:
../java.cxx:2248:93: error: invalid conversion from ‘const jvalue*’ to ‘jvalue*’
../java.cxx:2248:93: error: initializing argument 3 of ‘jint _Jv_JNIEnv::CallIntMethodA(__jobject*, _jmethodID*, jvalue*)’
make: *** [java.o] Erreur 1

Any solution PLZ ?
 
Joined
May 4, 2011
Messages
4
Reaction score
0
I have many problem with different platforms. anyone have solutions with my problem or share videos PLZ...? Thanks
grey.png
 
Joined
May 4, 2011
Messages
3
Reaction score
0
The problem is that the jni.h file does not exist in the source code compiled folder to compile it. In any folder must be normally existed? If I integrate it into the application, the compilation will complete successfully
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top