by79@linux-3ztp:~> sudo R CMD javareconf
[sudo] password for root:
Java interpreter : /usr/bin/java
Java version : 11.0.7
Java home path : /usr/lib64/jvm/java-11-openjdk-11
Java compiler : /usr/bin/javac
Java headers gen.:
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/lib64/jvm/java-11-openjdk-11/include -I/usr/lib64/jvm/java-11-openjdk-11/include/linux -I/usr/local/include -fpic -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -c conftest.c -o conftest.o
gcc -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o conftest.so conftest.o -L/usr/lib64/jvm/java-11-openjdk-11/lib/server -ljvm -L/usr/lib64/R/lib -lR
JAVA_HOME : /usr/lib64/jvm/java-11-openjdk-11
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.
by79@linux-3ztp:~> whereis java
java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz
by79@linux-3ztp:~> whereis jvm
jvm: /usr/lib64/jvm /etc/jvm /usr/share/jvm
I tried looking at other sites for a solution and thought the following might be relevant?
java - "Unable to run a simple JNI program" error message when installing rJava on R 3.6 for ubuntu bionic beaver - Stack Overflow
However, it is not in the context of Opensuse, so not sure whether I should just replace apt-get with zypper? Besides, it is quite deep for my level of understanding. Any suggestion on what to do next? Thanks.](java - "Unable to run a simple JNI program" error message when installing rJava on R 3.6 for ubuntu bionic beaver - Stack Overflow)
Installed R-core-packages:
erlangen:~ # R CMD javareconf
Java interpreter : /usr/lib64/jvm/java/bin/java
Java version : 15-internal
Java home path : /usr/lib64/jvm/java
Java compiler : /usr/lib64/jvm/java/bin/javac
Java headers gen.:
Java archive tool: /usr/lib64/jvm/java/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/lib64/jvm/java/include -I/usr/lib64/jvm/java/include/linux -I/usr/local/include -fpic -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -c conftest.c -o conftest.o
gcc -shared -L/usr/lib64/R/lib -flto=auto -o conftest.so conftest.o -L/usr/lib64/jvm/java/lib/server -ljvm -L/usr/lib64/R/lib -lR
JAVA_HOME : /usr/lib64/jvm/java
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.
erlangen:~ #
I went to the OpenSUSE R-rjava download page:
https://software.opensuse.org/package/R-rJava?locale=fa
In Yast, it gave me two options
https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/
http://download.opensuse.org/distribution/leap/15.1/repo/oss/
“https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/” is the default choice, and I went along with it. “http://download.opensuse.org/distribution/leap/15.1/repo/oss/” is left unchecked.
I then use the “R CMD javareconf” in xTerm but it did not work:
linux-3ztp:/home/by79 # R CMD javareconf
Java interpreter : /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
Java version : 1.8.0_252
Java home path : /usr/lib64/jvm/jre-1.8.0-openjdk
Java compiler : /usr/bin/javac
Java headers gen.:
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/local/include -fpic -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: No such file or directory
#include <jni.h>
^~~~~~~
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:167: conftest.o] Error 1
Unable to compile a JNI program
JAVA_HOME : /usr/lib64/jvm/jre-1.8.0-openjdk
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib64/R
Done.
“R CMD javareconf” also came up in the R console earlier when I was trying different ways to get it to work. I am guessing that the whole problem has to do with setting the Java environment and path? https://www.ibm.com/support/knowledgecenter/SSPT3X_3.0.0/com.ibm.swg.im.infosphere.biginsights.install.doc/doc/install_install_r.htmlkarlmistelberger, appreciate your suggestion though.
I then went back to the the R-rjava download page. This time I chose both “https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/” and “http://download.opensuse.org/distribution/leap/15.1/repo/oss/”…for some reason, it looks to be working now.
When you use openjdk instead of Oracle Java, the openjdk package is equivalent to the Oracle JRE and openjdk-devel is roughly (not exactly the same)equivalent to the Oracle JDK.
Since you’re building something in Java and not just running a pre-compiled Java app, you need the JDK with its development headers and additional libraries.
Run the following to discover what “openjdk-devel” packages are available, and install the one that’s appropriate for your currently installed Java. Note that your first post says you were configured to use openjdk 1.8 and the next posts say you were running openjdk 11. If uncertain what you need, install all three openjdk-devel packages, they should install side by side and won’t hurt.
zypper se openjdk-devel
You can install packages by space delimiting as follows
zypper in *pkg1 pkg2 pgk3*
If you have multiple Java installed on your system, you can switch between them with
update-alternatives --config java
I went to the OpenSUSE R-rjava download page:
openSUSE Software
In Yast, it gave me two options
https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/
http://download.opensuse.org/distribution/leap/15.1/repo/oss/
“https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/” is the default choice, and I went along with it. “http://download.opensuse.org/distribution/leap/15.1/repo/oss/” is left unchecked.
I then use the “R CMD javareconf” in xTerm but it did not work:
linux-3ztp:/home/by79 # R CMD javareconf
Java interpreter : /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
Java version : 1.8.0_252
Java home path : /usr/lib64/jvm/jre-1.8.0-openjdk
Java compiler : /usr/bin/javac
Java headers gen.:
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/local/include -fpic -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: No such file or directory
#include <jni.h>
^~~~~~~
compilation terminated.
make: *** [/usr/lib64/R/etc/Makeconf:167: conftest.o] Error 1
Unable to compile a JNI program
JAVA_HOME : /usr/lib64/jvm/jre-1.8.0-openjdk
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib64/R
Done.
“R CMD javareconf” also came up in the R console earlier when I was trying different ways to get it to work. I am guessing that the whole problem has to do with setting the Java environment and path? https://www.ibm.com/support/knowledgecenter/SSPT3X_3.0.0/com.ibm.swg.im.infosphere.biginsights.install.doc/doc/install_install_r.htmlkarlmistelberger, appreciate your suggestion though.
I then went back to the the R-rjava download page. This time I chose both “https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/” and “http://download.opensuse.org/distribution/leap/15.1/repo/oss/”…for some reason, it looks to be working now.
For the record: On page Install package devel:languages:R:released / R-rJava I selected the appropriate repo for Tumbleweed and got:
erlangen:~ # zypper lr 6
Alias : devel_languages_R_released
Name : R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)
URI : https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Tumbleweed/
Enabled : Yes
GPG Check : (r ) Yes
Priority : 99 (default priority)
Autorefresh : Off
Keep Packages : Off
Type : rpm-md
GPG Key URI : https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Tumbleweed/repodata/repomd.xml.key
Path Prefix :
Parent Service :
Keywords : ---
Repo Info Path : /etc/zypp/repos.d/devel_languages_R_released.repo
MD Cache Path : /var/cache/zypp/raw/devel_languages_R_released
erlangen:~ #
I got a smooth install:
erlangen:~ # zypper install R-rJava
New repository or package signing key received:
Repository: R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)
Key Name: devel:languages:R OBS Project <devel:languages:R@build.opensuse.org>
Key Fingerprint: 4BAAC60A 1E50F188 B7ACB3CD A35CB059 793371FE
Key Created: Mon Nov 5 03:25:25 2018
Key Expires: Wed Jan 13 03:25:25 2021
Rpm Name: gpg-pubkey-793371fe-5bdfaa15
Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): a
Building repository 'R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)' cache .....................................................................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
R-base-java R-rJava
2 new packages to install.
Overall download size: 944.3 KiB. Already cached: 0 B. After the operation, additional 3.0 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):
Retrieving package R-base-java-1-6.19.noarch (1/2), 7.6 KiB ( 74 B unpacked)
Retrieving: R-base-java-1-6.19.noarch.rpm .............................................................................................................................................................................................[done]
Retrieving package R-rJava-0.9.12-2.4.x86_64 (2/2), 936.6 KiB ( 3.0 MiB unpacked)
Retrieving: R-rJava-0.9.12-2.4.x86_64.rpm .................................................................................................................................................................................[done (2.1 MiB/s)]
Checking for file conflicts: ..........................................................................................................................................................................................................[done]
(1/2) Installing: R-base-java-1-6.19.noarch ...........................................................................................................................................................................................[done]
Additional rpm output:
Java interpreter : /usr/lib64/jvm/java/bin/java
Java version : 15-internal
Java home path : /usr/lib64/jvm/java
Java compiler : /usr/lib64/jvm/java/bin/javac
Java headers gen.:
Java archive tool: /usr/lib64/jvm/java/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/lib64/jvm/java/include -I/usr/lib64/jvm/java/include/linux -I/usr/local/include -fpic -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -c conftest.c -o conftest.o
gcc -shared -L/usr/lib64/R/lib -flto=auto -o conftest.so conftest.o -L/usr/lib64/jvm/java/lib/server -ljvm -L/usr/lib64/R/lib -lR
JAVA_HOME : /usr/lib64/jvm/java
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.
(2/2) Installing: R-rJava-0.9.12-2.4.x86_64 ...........................................................................................................................................................................................[done]
erlangen:~ #
Thanks tsu2. great to hear from you as always.
Run the following to discover what “openjdk-devel” packages are available, and install the one that’s appropriate for your currently installed Java. Note that your first post says you were configured to use openjdk 1.8 and the next posts say you were running openjdk 11. If uncertain what you need, install all three openjdk-devel packages, they should install side by side and won’t hurt.
If you have multiple Java installed on your system, you can switch between them with
by79@linux-3ztp:~> zypper se openjdk-devel
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+--------------------------+------------------------------------+--------
| java-10-openjdk-devel | OpenJDK 10 Development Environment | package
i | java-11-openjdk-devel | OpenJDK 11 Development Environment | package
| java-1_8_0-openjdk-devel | OpenJDK 8 Development Environment | package
I think I am currently using java-11-openjdk-devel…I was trying various versions installation via YAST earlier to try to get R to work, and stumble upon this version. Maybe the R-rjava download did something to make it work? Thanks again for your insight; helps me to get a better understanding how things work.
karlmistelberger:
For the record: On page Install package devel:languages:R:released / R-rJava I selected the appropriate repo for Tumbleweed and got:
erlangen:~ # zypper lr 6
Alias : devel_languages_R_released
Name : R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)
URI : https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Tumbleweed/
Enabled : Yes
GPG Check : (r ) Yes
Priority : 99 (default priority)
Autorefresh : Off
Keep Packages : Off
Type : rpm-md
GPG Key URI : https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Tumbleweed/repodata/repomd.xml.key
Path Prefix :
Parent Service :
Keywords : ---
Repo Info Path : /etc/zypp/repos.d/devel_languages_R_released.repo
MD Cache Path : /var/cache/zypp/raw/devel_languages_R_released
erlangen:~ #
I got a smooth install:
erlangen:~ # zypper install R-rJava
New repository or package signing key received:
Repository: R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)
Key Name: devel:languages:R OBS Project <devel:languages:R@build.opensuse.org>
Key Fingerprint: 4BAAC60A 1E50F188 B7ACB3CD A35CB059 793371FE
Key Created: Mon Nov 5 03:25:25 2018
Key Expires: Wed Jan 13 03:25:25 2021
Rpm Name: gpg-pubkey-793371fe-5bdfaa15
Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): a
Building repository 'R core components, supplements (like rkward), and CRAN packages (openSUSE_Tumbleweed)' cache .....................................................................................................................[done]
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
R-base-java R-rJava
2 new packages to install.
Overall download size: 944.3 KiB. Already cached: 0 B. After the operation, additional 3.0 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):
Retrieving package R-base-java-1-6.19.noarch (1/2), 7.6 KiB ( 74 B unpacked)
Retrieving: R-base-java-1-6.19.noarch.rpm .............................................................................................................................................................................................[done]
Retrieving package R-rJava-0.9.12-2.4.x86_64 (2/2), 936.6 KiB ( 3.0 MiB unpacked)
Retrieving: R-rJava-0.9.12-2.4.x86_64.rpm .................................................................................................................................................................................[done (2.1 MiB/s)]
Checking for file conflicts: ..........................................................................................................................................................................................................[done]
(1/2) Installing: R-base-java-1-6.19.noarch ...........................................................................................................................................................................................[done]
Additional rpm output:
Java interpreter : /usr/lib64/jvm/java/bin/java
Java version : 15-internal
Java home path : /usr/lib64/jvm/java
Java compiler : /usr/lib64/jvm/java/bin/javac
Java headers gen.:
Java archive tool: /usr/lib64/jvm/java/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -I"/usr/lib64/R/include" -DNDEBUG -I/usr/lib64/jvm/java/include -I/usr/lib64/jvm/java/include/linux -I/usr/local/include -fpic -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -c conftest.c -o conftest.o
gcc -shared -L/usr/lib64/R/lib -flto=auto -o conftest.so conftest.o -L/usr/lib64/jvm/java/lib/server -ljvm -L/usr/lib64/R/lib -lR
JAVA_HOME : /usr/lib64/jvm/java
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /usr/lib64/R
Done.
(2/2) Installing: R-rJava-0.9.12-2.4.x86_64 ...........................................................................................................................................................................................[done]
erlangen:~ #
by79:
Thank you karlmistelberger and noted. I am not well versed with systems and software but want to learn, so sometimes, I am not even asking the right questions, or not implementing things as they should be and there will be some gaps. Hope that you could be patient with me.
You’re welcome. Being a newbie I made the same mistakes. If it’s hard odds are good an easier option exists.