Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

java - unable to compile JNI program rJava

I want to install rJava but it doesnt work. When I am typing R CMD javareconf in the console I get the following error:

trying to compile and link a JNI progam
detected JNI cpp flags    :
detected JNI linker flags :
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g 
-c conftest.c -o conftest.o
conftest.c:1:17: error: jni.h: No such file or directory
conftest.c: In function 'main':
conftest.c:4: warning: implicit declaration of function 'JNI_CreateJavaVM'
make: *** [conftest.o] Error 1
Unable to compile a JNI program


Java library path:
JNI cpp flags    :
JNI linker flags :
Updating Java configuration in /usr/lib64/R
Done.

Any ideas how to fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I know this is closed but I'm adding my solution for completeness. In effect I had the same problem and all was correctly installed. I had also run the

sudo R CMD javareconf

for system wide setting. What I needed was for it to work for my user. And in this case you should run

R CMD javareconf -e

without sudo and with appended -e.

Worked for me. :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...