s-u / rJava

R to Java interface
https://RForge.net/rJava
235 stars 77 forks source link

Problems installing on Ubuntu 20.04 #255

Closed moldach closed 3 years ago

moldach commented 3 years ago

I've spent the past 3 hours trying to install rJava unsuccessfully on Ubuntu 20.04 LTS; I've followed almost every stackoverflow and advice here on the Issues page with no success:

> install.packages("rJava")
Installing package into ‘/home/mtg/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-13.tar.gz'
Content type 'application/x-gzip' length 664898 bytes (649 KB)
==================================================
downloaded 649 KB

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: ''
cpp flags   : '-I/usr/lib/jvm/java-14-openjdk-amd64/include -I/usr/lib/jvm/java-14-openjdk-amd64/include/linux'
java libs   : '-L/usr/lib/jvm/java-14-openjdk-amd64/lib/server -ljvm'
sed: -e expression #1, char 15: unterminated `s' command
sed: -e expression #1, char 15: unterminated `s' command
sed: -e expression #1, char 15: unterminated `s' command
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether -Xrs will be used... yes
checking whether JVM will be loaded dynamically... no
checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details.

Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.

ERROR: configuration failed for package ‘rJava’
* removing ‘/home/mtg/R/x86_64-pc-linux-gnu-library/4.0/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp5m5ndu/downloaded_packages’
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo R CMD javareconf
[sudo] password for mtg: 
*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 14.0.2
Java home path   : /usr/lib/jvm/java-14-openjdk-amd64
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 -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-14-openjdk-amd64/include -I/usr/lib/jvm/java-14-openjdk-amd64/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-14-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/java-14-openjdk-amd64
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/lib/R
Done.
moldach commented 3 years ago

A complete removal of Java (see here followed by re-installation - following instructions from here - does not work:

(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ # JAVA_LD_LIBRARY_PATH library path necessary at run-time
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ # JAVA_CPPFLAGS  C preprocessor flags necessary to compile JNI programs
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ # JAVA_LIBS      libraries (as linker flags) necessary to compile JNI programs
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_HOME=/opt/apps/jdk
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux "
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_LIBS="-L$JAVA_HOME/jre/lib/amd64/server -ljvm" 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ env|grep JAVA
JAVA_HOME=/opt/apps/jdk
JAVA_LD_LIBRARY_PATH=/opt/apps/jdk/jre/lib/amd64/server
JAVA_LIBS=-L/opt/apps/jdk/jre/lib/amd64/server -ljvm
JAVA_CPPFLAGS=-I/opt/apps/jdk/include -I/opt/apps/jdk/include/linux 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ R CMD javareconf
*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 11.0.10
Java home path   : /usr/lib/jvm/java-11-openjdk-amd64
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/opt/apps/jdk/include -I/opt/apps/jdk/include/linux 
detected JNI linker flags : -L/opt/apps/jdk/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/opt/apps/jdk/include -I/opt/apps/jdk/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: No such file or directory
    1 | #include <jni.h>
      |          ^~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:172: conftest.o] Error 1
Unable to compile a JNI program

JAVA_HOME        : /usr/lib/jvm/java-11-openjdk-amd64
Java library path: 
JNI cpp flags    : 
JNI linker flags : 
Updating Java configuration in /usr/lib/R
/usr/lib/R/bin/javareconf: 399: cannot create /usr/lib/R/etc/Makeconf.new: Permission denied
*** cannot create /usr/lib/R/etc/Makeconf.new
*** Please run as root if required.

(base) mtg@mtg-ThinkPad-P53:~/Downloads$ 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_HOME=/opt/apps/jdk(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_LIBS="-L$JAVA_HOME/jre/lib/amd64/server -ljvm" 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ export JAVA_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux "
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ env|grep JAVAJAVA_HOME=/opt/apps/jdk
JAVA_LD_LIBRARY_PATH=/opt/apps/jdk/jre/lib/amd64/server
JAVA_LIBS=-L/opt/apps/jdk/jre/lib/amd64/server -ljvm
JAVA_CPPFLAGS=-I/opt/apps/jdk/include -I/opt/apps/jdk/include/linux 
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo R CMD javareconf*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 11.0.10
Java home path   : /usr/lib/jvm/java-11-openjdk-amd64
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 -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/java-11-openjdk-amd64
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/lib/R
Done.

(base) mtg@mtg-ThinkPad-P53:~/Downloads$ dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libatk-wrapper-java libatk-wrapper-java-jni
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  ca-certificates-java default-jdk default-jdk-headless default-jre default-jre-headless
  java-common openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless
0 upgraded, 0 newly installed, 10 to remove and 24 not upgraded.
After this operation, 407 MB disk space will be freed.
(Reading database ... 463535 files and directories currently installed.)
Removing default-jdk (2:1.11-72) ...
Removing openjdk-11-jdk:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Removing default-jre (2:1.11-72) ...
Removing openjdk-11-jre:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Removing default-jdk-headless (2:1.11-72) ...
Removing openjdk-11-jdk-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Removing default-jre-headless (2:1.11-72) ...
Removing openjdk-11-jre-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Removing java-common (0.72) ...
Removing ca-certificates-java (20190405ubuntu1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ca-certificates (20210119~20.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

updates of cacerts keystore disabled.
done.
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo apt-get -y autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libatk-wrapper-java libatk-wrapper-java-jni
0 upgraded, 0 newly installed, 2 to remove and 24 not upgraded.
After this operation, 255 kB disk space will be freed.
(Reading database ... 463036 files and directories currently installed.)
Removing libatk-wrapper-java-jni:amd64 (0.37.1-1) ...
Removing libatk-wrapper-java (0.37.1-1) ...
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  ca-certificates-java* containerd* docker.io* gnome-screensaver* indicator-applet*
  indicator-appmenu* indicator-bluetooth* indicator-datetime* indicator-keyboard*
  indicator-messages* indicator-power* indicator-printers* indicator-session*
  indicator-sound* java-common* kio* kwayland-data* kwayland-integration* libdatrie-dev*
  libevent-2.0-5* libffi6* libkf5archive5* libkf5attica5* libkf5auth-data*
  libkf5bookmarks-data* libkf5codecs-data* libkf5configwidgets-data* libkf5coreaddons-data*
  libkf5crash5* libkf5dbusaddons-data* libkf5globalaccel-data* libkf5iconthemes-data*
  libkf5idletime5* libkf5jobwidgets-data* libkf5notifications-data* libkf5package-data*
  libkf5service-data* libkf5solid5-data* libkf5sonnet5-data* libkf5wallet-data*
  libkf5windowsystem-data* libkf5xmlgui-data* libnvidia-compute-460* libqt4-xml*
  libqtcore4* libqtdbus4* libthai-dev* libwebkit-1.0-2* linux-image-5.4.0-26-generic*
  linux-image-5.4.0-28-generic* linux-image-5.4.0-29-generic* linux-image-5.4.0-31-generic*
  linux-image-5.4.0-33-generic* linux-image-5.4.0-37-generic* linux-image-5.4.0-39-generic*
  linux-image-5.4.0-40-generic* linux-image-5.4.0-42-generic* linux-image-5.4.0-45-generic*
  linux-image-5.4.0-47-generic* linux-image-5.4.0-48-generic* linux-image-5.4.0-51-generic*
  linux-image-5.4.0-52-generic* linux-image-5.4.0-53-generic* linux-image-5.4.0-54-generic*
  linux-image-5.4.0-56-generic* linux-image-5.4.0-58-generic* linux-image-5.4.0-59-generic*
  linux-image-5.8.0-34-generic* linux-image-5.8.0-36-generic* linux-image-5.8.0-38-generic*
  linux-image-5.8.0-41-generic* linux-modules-5.4.0-26-generic*
  linux-modules-5.4.0-28-generic* linux-modules-5.4.0-29-generic*
  linux-modules-5.4.0-31-generic* linux-modules-5.4.0-33-generic*
  linux-modules-5.4.0-37-generic* linux-modules-5.4.0-39-generic*
  linux-modules-5.4.0-40-generic* linux-modules-5.4.0-42-generic*
  linux-modules-5.4.0-45-generic* linux-modules-5.4.0-47-generic*
  linux-modules-5.4.0-48-generic* linux-modules-5.4.0-51-generic*
  linux-modules-5.4.0-52-generic* linux-modules-5.4.0-53-generic*
  linux-modules-5.4.0-54-generic* linux-modules-5.4.0-56-generic*
  linux-modules-5.4.0-58-generic* linux-modules-5.4.0-59-generic*
  linux-modules-5.8.0-34-generic* linux-modules-5.8.0-36-generic*
  linux-modules-5.8.0-38-generic* linux-modules-5.8.0-41-generic*
  linux-modules-extra-5.4.0-26-generic* linux-modules-extra-5.4.0-28-generic*
  linux-modules-extra-5.4.0-29-generic* linux-modules-extra-5.4.0-31-generic*
  linux-modules-extra-5.4.0-33-generic* linux-modules-extra-5.4.0-37-generic*
  linux-modules-extra-5.4.0-39-generic* linux-modules-extra-5.4.0-40-generic*
  linux-modules-extra-5.4.0-42-generic* linux-modules-extra-5.4.0-45-generic*
  linux-modules-extra-5.4.0-47-generic* linux-modules-extra-5.4.0-48-generic*
  linux-modules-extra-5.4.0-51-generic* linux-modules-extra-5.4.0-52-generic*
  linux-modules-extra-5.4.0-53-generic* linux-modules-extra-5.4.0-54-generic*
  linux-modules-extra-5.4.0-56-generic* linux-modules-extra-5.4.0-58-generic*
  linux-modules-extra-5.4.0-59-generic* linux-modules-extra-5.8.0-34-generic*
  linux-modules-extra-5.8.0-36-generic* linux-modules-extra-5.8.0-38-generic*
  linux-modules-extra-5.8.0-41-generic* nvidia-compute-utils-460* nvidia-dkms-460*
  nvidia-kernel-common-460* openjdk-11-jre-headless* phonon4qt5* realvnc-vnc-server*
  unity-greeter* unity-gtk-module-common* unity-settings-daemon* virtualbox-6.1*
0 upgraded, 0 newly installed, 127 to remove and 24 not upgraded.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 463025 files and directories currently installed.)
Purging configuration files for libkf5codecs-data (5.68.0-0ubuntu1) ...
Purging configuration files for libkf5package-data (5.68.0-0ubuntu1) ...
Purging configuration files for nvidia-compute-utils-460 (460.32.03-0ubuntu0.20.04.1) ...
userdel: user nvidia-persistenced is currently used by process 1445
Purging configuration files for libkf5idletime5:amd64 (5.68.0-0ubuntu1) ...
Purging configuration files for indicator-appmenu (15.02.0+16.10.20160927-0ubuntu5) ...
Purging configuration files for linux-modules-5.4.0-40-generic (5.4.0-40.44) ...
dpkg: warning: while removing linux-modules-5.4.0-40-generic, directory '/lib/modules/5.4.0-40-generic' not empty so not removed
Purging configuration files for unity-gtk-module-common (0.0.0+18.04.20171202-0ubuntu2) ...
Purging configuration files for libkf5service-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-modules-5.8.0-38-generic (5.8.0-38.43~20.04.1) ...
dpkg: warning: while removing linux-modules-5.8.0-38-generic, directory '/lib/modules/5.8.0-38-generic' not empty so not removed
Purging configuration files for linux-image-5.4.0-31-generic (5.4.0-31.35) ...
Purging configuration files for linux-modules-5.4.0-29-generic (5.4.0-29.33) ...
dpkg: warning: while removing linux-modules-5.4.0-29-generic, directory '/lib/modules/5.4.0-29-generic' not empty so not removed
Purging configuration files for linux-modules-5.4.0-54-generic (5.4.0-54.60) ...
dpkg: warning: while removing linux-modules-5.4.0-54-generic, directory '/lib/modules/5.4.0-54-generic' not empty so not removed
Purging configuration files for linux-modules-5.4.0-31-generic (5.4.0-31.35) ...
Purging configuration files for nvidia-dkms-460 (460.32.03-0ubuntu0.20.04.1) ...
update-initramfs: deferring update (trigger activated)
Purging configuration files for java-common (0.72) ...
Purging configuration files for linux-modules-extra-5.4.0-47-generic (5.4.0-47.51) ...
Purging configuration files for linux-image-5.8.0-41-generic (5.8.0-41.46~20.04.1) ...
Purging configuration files for linux-modules-5.4.0-45-generic (5.4.0-45.49) ...
dpkg: warning: while removing linux-modules-5.4.0-45-generic, directory '/lib/modules/5.4.0-45-generic' not empty so not removed
Purging configuration files for linux-modules-5.4.0-26-generic (5.4.0-26.30) ...
Purging configuration files for linux-modules-5.4.0-33-generic (5.4.0-33.37) ...
Purging configuration files for libkf5solid5-data (5.68.0-0ubuntu1) ...
Purging configuration files for libkf5bookmarks-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-33-generic (5.4.0-33.37) ...
Purging configuration files for indicator-printers (0.1.7+17.10.20171101-0ubuntu2) ...
Purging configuration files for libkf5auth-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-modules-extra-5.8.0-36-generic (5.8.0-36.40~20.04.1) ...
Purging configuration files for indicator-applet (12.10.2+20.04.20200409-0ubuntu1) ...
Purging configuration files for linux-modules-extra-5.4.0-53-generic (5.4.0-53.59) ...
Purging configuration files for linux-modules-extra-5.4.0-37-generic (5.4.0-37.41) ...
Purging configuration files for linux-modules-extra-5.4.0-42-generic (5.4.0-42.46) ...
Purging configuration files for linux-image-5.4.0-26-generic (5.4.0-26.30) ...
Purging configuration files for linux-image-5.4.0-53-generic (5.4.0-53.59) ...
Purging configuration files for indicator-keyboard (0.0.0+19.10.20190716-0ubuntu3) ...
Purging configuration files for openjdk-11-jre-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Purging configuration files for libkf5archive5:amd64 (5.68.0-0ubuntu1) ...
Purging configuration files for libkf5windowsystem-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-29-generic (5.4.0-29.33) ...
Purging configuration files for linux-modules-extra-5.4.0-52-generic (5.4.0-52.57) ...
Purging configuration files for linux-image-5.8.0-34-generic (5.8.0-34.37~20.04.2) ...
Purging configuration files for libnvidia-compute-460:amd64 (460.32.03-0ubuntu0.20.04.1) ...
Purging configuration files for libffi6:amd64 (3.1-2+deb8u1) ...
Purging configuration files for libwebkit-1.0-2 (1.2.0-1) ...
Purging configuration files for linux-modules-5.4.0-39-generic (5.4.0-39.43) ...
dpkg: warning: while removing linux-modules-5.4.0-39-generic, directory '/lib/modules/5.4.0-39-generic' not empty so not removed
Purging configuration files for docker.io (19.03.8-0ubuntu1.20.04.2) ...

Nuking /var/lib/docker ...
  (if this is wrong, press Ctrl+C NOW!)

+ sleep 10

+ rm -rf /var/lib/docker/builder /var/lib/docker/buildkit /var/lib/docker/containers /var/lib/docker/image /var/lib/docker/network /var/lib/docker/nuke-graph-directory.sh /var/lib/docker/overlay2 /var/lib/docker/plugins /var/lib/docker/runtimes /var/lib/docker/swarm /var/lib/docker/tmp /var/lib/docker/trust /var/lib/docker/volumes
dpkg: warning: while removing docker.io, directory '/etc/docker' not empty so not removed
Purging configuration files for linux-modules-extra-5.8.0-34-generic (5.8.0-34.37~20.04.2) ...
Purging configuration files for libkf5xmlgui-data (5.68.0-0ubuntu2) ...
Purging configuration files for nvidia-kernel-common-460 (460.32.03-0ubuntu0.20.04.1) ...
update-initramfs: deferring update (trigger activated)
Purging configuration files for linux-modules-extra-5.4.0-39-generic (5.4.0-39.43) ...
Purging configuration files for linux-modules-5.4.0-59-generic (5.4.0-59.65) ...
Purging configuration files for linux-modules-extra-5.4.0-40-generic (5.4.0-40.44) ...
Purging configuration files for libkf5configwidgets-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-58-generic (5.4.0-58.64) ...
Purging configuration files for linux-modules-5.4.0-42-generic (5.4.0-42.46) ...
dpkg: warning: while removing linux-modules-5.4.0-42-generic, directory '/lib/modules/5.4.0-42-generic' not empty so not removed
Purging configuration files for linux-modules-extra-5.4.0-33-generic (5.4.0-33.37) ...
Purging configuration files for indicator-messages (13.10.1+18.10.20180918-0ubuntu2) ...
Purging configuration files for linux-modules-extra-5.4.0-31-generic (5.4.0-31.35) ...
Purging configuration files for libevent-2.0-5:amd64 (2.0.21-stable-2+deb8u1) ...
Purging configuration files for indicator-bluetooth (0.0.6+17.10.20170605-0ubuntu3) ...
Purging configuration files for indicator-sound (12.10.2+18.10.20180612-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-56-generic (5.4.0-56.62) ...
Purging configuration files for linux-modules-extra-5.4.0-54-generic (5.4.0-54.60) ...
Purging configuration files for linux-image-5.4.0-37-generic (5.4.0-37.41) ...
Purging configuration files for linux-image-5.4.0-40-generic (5.4.0-40.44) ...
Purging configuration files for linux-modules-5.8.0-36-generic (5.8.0-36.40~20.04.1) ...
Purging configuration files for linux-modules-extra-5.4.0-26-generic (5.4.0-26.30) ...
Purging configuration files for linux-modules-5.4.0-52-generic (5.4.0-52.57) ...
Purging configuration files for libkf5coreaddons-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-52-generic (5.4.0-52.57) ...
Purging configuration files for linux-modules-extra-5.8.0-38-generic (5.8.0-38.43~20.04.1) ...
Purging configuration files for libqt4-xml:amd64 (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u2) ...
Purging configuration files for linux-modules-5.4.0-53-generic (5.4.0-53.59) ...
Purging configuration files for linux-image-5.4.0-39-generic (5.4.0-39.43) ...
Purging configuration files for linux-image-5.4.0-51-generic (5.4.0-51.56) ...
Purging configuration files for linux-modules-extra-5.4.0-59-generic (5.4.0-59.65) ...
Purging configuration files for linux-modules-5.8.0-41-generic (5.8.0-41.46~20.04.1) ...
Purging configuration files for linux-modules-extra-5.4.0-45-generic (5.4.0-45.49) ...
Purging configuration files for linux-modules-extra-5.4.0-51-generic (5.4.0-51.56) ...
Purging configuration files for libkf5dbusaddons-data (5.68.0-0ubuntu1) ...
Purging configuration files for linux-modules-5.8.0-34-generic (5.8.0-34.37~20.04.2) ...
Purging configuration files for libkf5notifications-data (5.68.0-0ubuntu1) ...
Purging configuration files for unity-greeter (18.04.0+20.04.20200312-0ubuntu2) ...
Purging configuration files for libkf5crash5:amd64 (5.68.0-0ubuntu1) ...
Purging configuration files for linux-modules-5.4.0-51-generic (5.4.0-51.56) ...
Purging configuration files for linux-modules-5.4.0-58-generic (5.4.0-58.64) ...
Purging configuration files for unity-settings-daemon (15.04.1+20.04.20200325-0ubuntu1) ...
Purging configuration files for libqtcore4:amd64 (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u2) ...
Purging configuration files for linux-modules-5.4.0-48-generic (5.4.0-48.52) ...
dpkg: warning: while removing linux-modules-5.4.0-48-generic, directory '/lib/modules/5.4.0-48-generic' not empty so not removed
Purging configuration files for libkf5wallet-data (5.68.0-0ubuntu2) ...
Purging configuration files for linux-modules-5.4.0-37-generic (5.4.0-37.41) ...
Purging configuration files for libkf5jobwidgets-data (5.68.0-0ubuntu1) ...
Purging configuration files for kio (5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-47-generic (5.4.0-47.51) ...
Purging configuration files for linux-image-5.4.0-48-generic (5.4.0-48.52) ...
Purging configuration files for libkf5sonnet5-data (5.68.0-0ubuntu1) ...
Purging configuration files for libkf5iconthemes-data (5.68.0-0ubuntu1) ...
Purging configuration files for indicator-session (17.3.20+19.10.20190921-0ubuntu1) ...
Purging configuration files for libthai-dev:amd64 (0.1.28-3) ...
Purging configuration files for linux-image-5.8.0-38-generic (5.8.0-38.43~20.04.1) ...
Purging configuration files for phonon4qt5:amd64 (4:4.11.1-3build1) ...
Purging configuration files for linux-modules-extra-5.4.0-58-generic (5.4.0-58.64) ...
Purging configuration files for linux-modules-5.4.0-56-generic (5.4.0-56.62) ...
Purging configuration files for linux-modules-5.4.0-28-generic (5.4.0-28.32) ...
dpkg: warning: while removing linux-modules-5.4.0-28-generic, directory '/lib/modules/5.4.0-28-generic' not empty so not removed
Purging configuration files for linux-modules-5.4.0-47-generic (5.4.0-47.51) ...
Purging configuration files for libkf5globalaccel-data (5.68.0-0ubuntu1) ...
Purging configuration files for indicator-datetime (15.10+20.04.20200217-0ubuntu1) ...
Purging configuration files for indicator-power (12.10.6+17.10.20170829.1-0ubuntu5) ...
Purging configuration files for libdatrie-dev:amd64 (0.2.12-3) ...
Purging configuration files for linux-image-5.4.0-28-generic (5.4.0-28.32) ...
rmdir: failed to remove '/lib/modules/5.4.0-28-generic': Directory not empty
Purging configuration files for gnome-screensaver (3.6.1-11ubuntu4) ...
Purging configuration files for linux-modules-extra-5.4.0-56-generic (5.4.0-56.62) ...
Purging configuration files for linux-image-5.4.0-45-generic (5.4.0-45.49) ...
Purging configuration files for linux-image-5.4.0-42-generic (5.4.0-42.46) ...
Purging configuration files for linux-modules-extra-5.4.0-48-generic (5.4.0-48.52) ...
Purging configuration files for realvnc-vnc-server (6.7.2.42622) ...
rmdir: failed to remove '/etc/vnc': Directory not empty
Purging configuration files for linux-modules-extra-5.8.0-41-generic (5.8.0-41.46~20.04.1) ...
Purging configuration files for ca-certificates-java (20190405ubuntu1) ...
Purging configuration files for linux-modules-extra-5.4.0-28-generic (5.4.0-28.32) ...
Purging configuration files for linux-modules-extra-5.4.0-29-generic (5.4.0-29.33) ...
Purging configuration files for libqtdbus4:amd64 (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u2) ...
Purging configuration files for containerd (1.3.3-0ubuntu2.2) ...
Purging configuration files for linux-image-5.4.0-59-generic (5.4.0-59.65) ...
Purging configuration files for kwayland-data (4:5.68.0-0ubuntu1) ...
Purging configuration files for linux-image-5.4.0-54-generic (5.4.0-54.60) ...
Purging configuration files for kwayland-integration:amd64 (4:5.18.4.1-0ubuntu1) ...
Purging configuration files for linux-image-5.8.0-36-generic (5.8.0-36.40~20.04.1) ...
Purging configuration files for virtualbox-6.1 (6.1.6-137129~Ubuntu~eoan) ...
Purging configuration files for libkf5attica5:amd64 (5.68.0-0ubuntu1) ...
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.8.0-44-generic
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo rm -rf /usr/lib/jvm/*
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done
update-alternatives: error: no alternatives for ControlPanel
update-alternatives: error: no alternatives for java
update-alternatives: error: no alternatives for java_vm
update-alternatives: error: no alternatives for javaws
update-alternatives: error: no alternatives for jcontrol
update-alternatives: error: no alternatives for jexec
update-alternatives: error: no alternatives for keytool
update-alternatives: error: no alternatives for mozilla-javaplugin.so
update-alternatives: error: no alternatives for orbd
update-alternatives: error: no alternatives for pack200
update-alternatives: error: no alternatives for policytool
update-alternatives: error: no alternatives for rmid
update-alternatives: error: no alternatives for rmiregistry
update-alternatives: error: no alternatives for servertool
update-alternatives: error: no alternatives for tnameserv
update-alternatives: error: no alternatives for unpack200
update-alternatives: error: no alternatives for appletviewer
update-alternatives: error: no alternatives for apt
update-alternatives: error: no alternatives for extcheck
update-alternatives: error: no alternatives for HtmlConverter
update-alternatives: error: no alternatives for idlj
update-alternatives: error: no alternatives for jar
update-alternatives: error: no alternatives for jarsigner
update-alternatives: error: no alternatives for javac
update-alternatives: error: no alternatives for javadoc
update-alternatives: error: no alternatives for javah
update-alternatives: error: no alternatives for javap
update-alternatives: error: no alternatives for jconsole
update-alternatives: error: no alternatives for jdb
update-alternatives: error: no alternatives for jhat
update-alternatives: error: no alternatives for jinfo
update-alternatives: error: no alternatives for jmap
update-alternatives: error: no alternatives for jps
update-alternatives: error: no alternatives for jrunscript
update-alternatives: error: no alternatives for jsadebugd
update-alternatives: error: no alternatives for jstack
update-alternatives: error: no alternatives for jstat
update-alternatives: error: no alternatives for jstatd
update-alternatives: error: no alternatives for native2ascii
update-alternatives: error: no alternatives for rmic
update-alternatives: error: no alternatives for schemagen
update-alternatives: error: no alternatives for serialver
update-alternatives: error: no alternatives for wsgen
update-alternatives: error: no alternatives for wsimport
update-alternatives: error: no alternatives for xjc
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo updatedb
sudo: updatedb: command not found
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo locate -b '\pack200'
sudo: locate: command not found
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ java -version

Command 'java' not found, but can be installed with:

sudo apt install openjdk-11-jre-headless  # version 11.0.10+9-0ubuntu1~20.04, or
sudo apt install default-jre              # version 2:1.11-72
sudo apt install openjdk-8-jre-headless   # version 8u282-b08-0ubuntu1~20.04
sudo apt install openjdk-13-jre-headless  # version 13.0.4+8-1~20.04
sudo apt install openjdk-14-jre-headless  # version 14.0.2+12-1~20.04

(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo apt-get install default-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java default-jdk-headless default-jre default-jre-headless java-common
  libatk-wrapper-java libatk-wrapper-java-jni openjdk-11-jdk openjdk-11-jdk-headless
  openjdk-11-jre openjdk-11-jre-headless
Suggested packages:
  openjdk-11-demo openjdk-11-source visualvm fonts-ipafont-gothic fonts-ipafont-mincho
  fonts-wqy-microhei | fonts-wqy-zenhei
The following NEW packages will be installed:
  ca-certificates-java default-jdk default-jdk-headless default-jre default-jre-headless
  java-common libatk-wrapper-java libatk-wrapper-java-jni openjdk-11-jdk
  openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless
0 upgraded, 12 newly installed, 0 to remove and 24 not upgraded.
Need to get 105 kB/263 MB of archives.
After this operation, 407 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 java-common all 0.72 [6,816 B]
Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libatk-wrapper-java all 0.37.1-1 [53.0 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libatk-wrapper-java-jni amd64 0.37.1-1 [45.1 kB]
Fetched 105 kB in 1s (83.1 kB/s)                
Selecting previously unselected package java-common.
(Reading database ... 462959 files and directories currently installed.)
Preparing to unpack .../00-java-common_0.72_all.deb ...
Unpacking java-common (0.72) ...
Selecting previously unselected package openjdk-11-jre-headless:amd64.
Preparing to unpack .../01-openjdk-11-jre-headless_11.0.10+9-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-11-jre-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Selecting previously unselected package default-jre-headless.
Preparing to unpack .../02-default-jre-headless_2%3a1.11-72_amd64.deb ...
Unpacking default-jre-headless (2:1.11-72) ...
Selecting previously unselected package ca-certificates-java.
Preparing to unpack .../03-ca-certificates-java_20190405ubuntu1_all.deb ...
Unpacking ca-certificates-java (20190405ubuntu1) ...
Selecting previously unselected package openjdk-11-jre:amd64.
Preparing to unpack .../04-openjdk-11-jre_11.0.10+9-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-11-jre:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Selecting previously unselected package default-jre.
Preparing to unpack .../05-default-jre_2%3a1.11-72_amd64.deb ...
Unpacking default-jre (2:1.11-72) ...
Selecting previously unselected package openjdk-11-jdk-headless:amd64.
Preparing to unpack .../06-openjdk-11-jdk-headless_11.0.10+9-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-11-jdk-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Selecting previously unselected package default-jdk-headless.
Preparing to unpack .../07-default-jdk-headless_2%3a1.11-72_amd64.deb ...
Unpacking default-jdk-headless (2:1.11-72) ...
Selecting previously unselected package openjdk-11-jdk:amd64.
Preparing to unpack .../08-openjdk-11-jdk_11.0.10+9-0ubuntu1~20.04_amd64.deb ...
Unpacking openjdk-11-jdk:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Selecting previously unselected package default-jdk.
Preparing to unpack .../09-default-jdk_2%3a1.11-72_amd64.deb ...
Unpacking default-jdk (2:1.11-72) ...
Selecting previously unselected package libatk-wrapper-java.
Preparing to unpack .../10-libatk-wrapper-java_0.37.1-1_all.deb ...
Unpacking libatk-wrapper-java (0.37.1-1) ...
Selecting previously unselected package libatk-wrapper-java-jni:amd64.
Preparing to unpack .../11-libatk-wrapper-java-jni_0.37.1-1_amd64.deb ...
Unpacking libatk-wrapper-java-jni:amd64 (0.37.1-1) ...
Setting up java-common (0.72) ...
Setting up libatk-wrapper-java (0.37.1-1) ...
Setting up libatk-wrapper-java-jni:amd64 (0.37.1-1) ...
Setting up default-jre-headless (2:1.11-72) ...
Setting up openjdk-11-jre-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jfr to provide /usr/bin/jfr (jfr) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
update-binfmts: warning: current package is openjdk-11, but binary format already installed by openjdk-8
Setting up openjdk-11-jre:amd64 (11.0.10+9-0ubuntu1~20.04) ...
Setting up openjdk-11-jdk-headless:amd64 (11.0.10+9-0ubuntu1~20.04) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdeprscan to provide /usr/bin/jdeprscan (jdeprscan) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jimage to provide /usr/bin/jimage (jimage) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jlink to provide /usr/bin/jlink (jlink) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jmod to provide /usr/bin/jmod (jmod) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jshell to provide /usr/bin/jshell (jshell) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jaotc to provide /usr/bin/jaotc (jaotc) in auto mode
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jhsdb to provide /usr/bin/jhsdb (jhsdb) in auto mode
Setting up default-jre (2:1.11-72) ...
Setting up default-jdk-headless (2:1.11-72) ...
Setting up openjdk-11-jdk:amd64 (11.0.10+9-0ubuntu1~20.04) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
Setting up ca-certificates-java (20190405ubuntu1) ...
head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:EC-ACC.pem
Adding debian:Certigna.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:Amazon_Root_CA_2.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:emSign_Root_CA_-_G1.pem
Adding debian:emSign_ECC_Root_CA_-_C3.pem
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:SecureSign_RootCA11.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:TrustCor_ECA-1.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:Microsoft_ECC_Root_Certificate_Authority_2017.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:NAVER_Global_Root_Certification_Authority.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:OISTE_WISeKey_Global_Root_GC_CA.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:AC_RAIZ_FNMT-RCM.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:ISRG_Root_X1.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:GTS_Root_R3.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:emSign_Root_CA_-_C1.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:Entrust_Root_Certification_Authority_-_G4.pem
Adding debian:SSL.com_Root_Certification_Authority_ECC.pem
Adding debian:TrustCor_RootCert_CA-2.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:SSL.com_Root_Certification_Authority_RSA.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:Trustwave_Global_ECC_P256_Certification_Authority.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:Amazon_Root_CA_1.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:GDCA_TrustAUTH_R5_ROOT.pem
Adding debian:Secure_Global_CA.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_RSA_R2.pem
Adding debian:GTS_Root_R1.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:GTS_Root_R4.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:certSIGN_Root_CA_G2.pem
Adding debian:SecureTrust_CA.pem
Adding debian:Microsoft_RSA_Root_Certificate_Authority_2017.pem
Adding debian:GlobalSign_Root_CA_-_R6.pem
Adding debian:UCA_Global_G2_Root.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:UCA_Extended_Validation_Root.pem
Adding debian:TrustCor_RootCert_CA-1.pem
Adding debian:Amazon_Root_CA_3.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:Hongkong_Post_Root_CA_3.pem
Adding debian:ACCVRAIZ1.pem
Adding debian:ssl-cert-snakeoil.pem
Adding debian:e-Szigno_Root_CA_2017.pem
Adding debian:Izenpe.com.pem
Adding debian:SSL.com_EV_Root_Certification_Authority_ECC.pem
Adding debian:emSign_ECC_Root_CA_-_G3.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:GTS_Root_R2.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:SZAFIR_ROOT_CA2.pem
Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:Trustwave_Global_Certification_Authority.pem
Adding debian:Trustwave_Global_ECC_P384_Certification_Authority.pem
Adding debian:Certigna_Root_CA.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:Amazon_Root_CA_4.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:Certum_Trusted_Network_CA_2.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
done.
Setting up default-jdk (2:1.11-72) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ca-certificates (20210119~20.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo R CMD javareconf
*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 11.0.10
Java home path   : /usr/lib/jvm/java-11-openjdk-amd64
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 -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/java-11-openjdk-amd64
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/lib/R
Done.

(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo apt-get install r-cran-rjava
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  r-cran-rjava
0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
Need to get 0 B/689 kB of archives.
After this operation, 1,900 kB of additional disk space will be used.
Selecting previously unselected package r-cran-rjava.
(Reading database ... 463503 files and directories currently installed.)
Preparing to unpack .../r-cran-rjava_0.9-13-1cran1.2004.0_amd64.deb ...
Unpacking r-cran-rjava (0.9-13-1cran1.2004.0) ...
Setting up r-cran-rjava (0.9-13-1cran1.2004.0) ...
(base) mtg@mtg-ThinkPad-P53:~/Downloads$ sudo apt-get install libgdal-dev libproj-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgdal-dev is already the newest version (3.0.4+dfsg-1build3).
libproj-dev is already the newest version (6.3.1-1).
libproj-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
s-u commented 3 years ago

Lol, this really cracked me up. It's like saying "I asked all the drug dealers in town how to get to the beach, but three days later I'm all beaten up, penniless and nowhere close to the beach".

Ok, so is there any really good reason you didn't use the obvious

sudo apt-get install r-cran-rjava

I suppose it may be too late now that you likely broke your system beyond repair with all the "good advice", but if you still want to do it the hard way, you can try

sudo apt-get install r-base-dev openjdk-14-jdk
sudo R CMD javareconf

but do not set JAVA_HOME - if you read the output you'll see that is your first problem to start with.

Both approaches work on a clean Ubuntu 20.04. If it doesn't work for you, then you likely broke something and you may need to look at config.log and do some forensics.

moldach commented 3 years ago

Please leave issues open until they are fixed...This isn't the first system/time I've had trouble asking drug dealers how to get to the beach for 'rJava' ....

s-u commented 3 years ago

@moldach There is no issue and hence nothing to fix. If you have a real issue, please file it properly with important details such as steps to reproduce. Both approaches listed above work, what you posted is not reproducible and not a report.

Before you ask questions basic steps 1) read the output (which clearly tells you that your manual overrides are wrong) and 2) check config.log for causes - if you want any help that is the minimal amount of information you have to provide since without it there is no way for anyone to tell what's wrong in your setup and finally 3) always include full detail on what you did.

moldach commented 3 years ago

no issue and hence nothing to fix

The issue is I cannot use your package. There is dependency issues with Java for your package that need to be explained better in the docs - lots of users are facing similar issues and we want the word from the horses mouth (not the "drug dealers")

This is the second time filing an issue for Ubuntu 20.04 with the same issue (both new computers/installations).

One year later, filing the same issue and I'm following the exact steps outlined here: https://gist.github.com/s-u/7fb617ccb938f50d00d655ca8b57f377

root@mtg-ThinkPad-P53:/home/mtg/Downloads# sudo apt install -f r-cran-rjava
Reading package lists... Done
Building dependency tree       
Reading state information... Done
r-cran-rjava is already the newest version (0.9-13-1cran1.2004.0).
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
root@mtg-ThinkPad-P53:/home/mtg/Downloads# sudo apt-get install -y default-jdk r-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
default-jdk is already the newest version (2:1.11-72).
r-base-dev is already the newest version (4.0.4-1.2004.0).
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
root@mtg-ThinkPad-P53:/home/mtg/Downloads# sudo R CMD javareconf
*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version     : 11.0.10
Java home path   : /usr/lib/jvm/java-11-openjdk-amd64
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 -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux     -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-fhxXXR/r-base-4.0.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm -L/usr/lib/R/lib -lR

JAVA_HOME        : /usr/lib/jvm/java-11-openjdk-amd64
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/lib/R
Done.

root@mtg-ThinkPad-P53:/home/mtg/Downloads# 
root@mtg-ThinkPad-P53:/home/mtg/Downloads# sudo R -e 'install.packages("rJava",,"https://cloud.r-project.org")'

R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("rJava",,"https://cloud.r-project.org")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-13.tar.gz'
Content type 'application/x-gzip' length 664898 bytes (649 KB)
==================================================
downloaded 649 KB

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: ''
cpp flags   : '-I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux'
java libs   : '-L/usr/lib/jvm/java-11-openjdk-amd64/lib/server -ljvm'
sed: -e expression #1, char 15: unterminated `s' command
sed: -e expression #1, char 15: unterminated `s' command
sed: -e expression #1, char 15: unterminated `s' command
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether -Xrs will be used... yes
checking whether JVM will be loaded dynamically... no
checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details.

Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.

ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/local/lib/R/site-library/rJava’

The downloaded source packages are in
        ‘/tmp/RtmpHKVtSs/downloaded_packages’
Warning message:
In install.packages("rJava", , "https://cloud.r-project.org") :
  installation of package ‘rJava’ had non-zero exit status
> 
> 
root@mtg-ThinkPad-P53:/home/mtg/Downloads# R --quiet -e 'library(rJava); .jinit(); J("java.lang.System")$getProperty("java.version")'
> library(rJava); .jinit(); J("java.lang.System")$getProperty("java.version")
[1] "11.0.10"
> 
> 

I feel like I'm beating-the-dead horse because you keep telling me to look at config.log; however, I have no idea where to find this and have asked before without a clear response.

Sorry for being persistent but If you want me to check config.log I need to know where I can find it because it is not within my project directory.

root@mtg-ThinkPad-P53:/home/mtg/r-projects/supervised-umap# find . confg.log.
./.Rproj.user
./.Rproj.user/9149C76A
./.Rproj.user/9149C76A/sources
./.Rproj.user/9149C76A/sources/s-9E5B33A3
./.Rproj.user/9149C76A/sources/s-9E5B33A3/lock_file
./.Rproj.user/9149C76A/sources/s-9E5B33A3/A183914E-contents
./.Rproj.user/9149C76A/sources/s-9E5B33A3/A183914E
./.Rproj.user/9149C76A/sources/prop
./.Rproj.user/9149C76A/sources/prop/INDEX
./.Rproj.user/9149C76A/sources/prop/035A4C79
./.Rproj.user/9149C76A/sources/prop/DA0DA1C5
./.Rproj.user/9149C76A/sources/prop/33CE2BBE
./.Rproj.user/9149C76A/sources/prop/1D5AE7D2
./.Rproj.user/9149C76A/sources/prop/3D0B1679
./.Rproj.user/9149C76A/sources/prop/751C2E56
./.Rproj.user/9149C76A/sources/prop/368FD570
./.Rproj.user/9149C76A/sources/per
./.Rproj.user/9149C76A/sources/per/u
./.Rproj.user/9149C76A/sources/per/t
./.Rproj.user/9149C76A/explorer-cache
./.Rproj.user/9149C76A/presentation
./.Rproj.user/9149C76A/tutorial
./.Rproj.user/9149C76A/viewer_history
./.Rproj.user/9149C76A/profiles-cache
./.Rproj.user/9149C76A/saved_source_markers
./.Rproj.user/9149C76A/bibliography-index
./.Rproj.user/9149C76A/ctx
./.Rproj.user/9149C76A/rmd-outputs
./.Rproj.user/9149C76A/viewer-cache
./.Rproj.user/9149C76A/persistent-state
./.Rproj.user/9149C76A/pcs
./.Rproj.user/9149C76A/pcs/files-pane.pper
./.Rproj.user/9149C76A/pcs/debug-breakpoints.pper
./.Rproj.user/9149C76A/pcs/workbench-pane.pper
./.Rproj.user/9149C76A/pcs/windowlayoutstate.pper
./.Rproj.user/9149C76A/pcs/source-pane.pper
./.Rproj.user/shared
./.Rproj.user/shared/notebooks
./.Rproj.user/shared/notebooks/paths
./.Rproj.user/shared/notebooks/F69D73BA-index
./.Rproj.user/shared/notebooks/F69D73BA-index/1
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76AF45B3A10
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76AF45B3A10/chunks.json
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76AD9F5ADC6
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76AD9F5ADC6/chunks.json
./.Rproj.user/shared/notebooks/F69D73BA-index/1/s
./.Rproj.user/shared/notebooks/F69D73BA-index/1/s/chunks.json
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76A4D75A388
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76A4D75A388/chunks.json
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76A10385659
./.Rproj.user/shared/notebooks/F69D73BA-index/1/9149C76A10385659/chunks.json
./.Rproj.user/shared/notebooks/8CC9793B-index2
./.Rproj.user/shared/notebooks/8CC9793B-index2/1
./.Rproj.user/shared/notebooks/8CC9793B-index2/1/s
./.Rproj.user/shared/notebooks/8CC9793B-index2/1/s/chunks.json
./.Rproj.user/shared/notebooks/8CC9793B-index2/1/9149C76A4D75A388
./.Rproj.user/shared/notebooks/8CC9793B-index2/1/9149C76A4D75A388/chunks.json
./.Rproj.user/shared/notebooks/patch-chunk-names
./index.Rmd
./img_00.png
./img_01.png
./supervised-umap.Rproj
./header.html
./cssBackground.css
./.Rhistory
./background.png
./index2.Rmd
./index.html
./r-python
find: ‘confg.log’: No such file or directory
s-u commented 3 years ago

I would strongly recommend you make yourself familiar with R first, the concept of packages and read the documentation.

To make things very clear assuming no knowledge at all, please follow the following steps:

  1. open a Terminal window
  2. type the following commands (you may be prompted for your password):
    sudo apt-get install -y r-cran-rjava
    R
  3. now you are in the so-called "R console", type the following commands to use rJava:
    library(rJava)
    .jinit()

That is all you need to do.

If you are interested in the development of rJava, you can compile rJava from sources, but that requires all tools as described in the R documentation (see Writing R Extensions). Follow the following steps in that case:

  1. open a Terminal window
  2. type the following commands:
    sudo apt-get install -y r-base-dev openjdk-11-jdk
    sudo R CMD javareconf
    R
  3. now in R console type:
    install.packages("rJava",,"https://cloud.R-project.org")
    library(rJava)
    .jinit()

You can replace the version (11) of the JDK with any other version supported by the system. The version required may depend on the Java software you wish to run.

pwaltman commented 2 years ago

sudo apt-get install -y r-cran-rjava

As of July 7, 2022, this package still fails to install via apt because it requires the r-api-3.5 package: $ sudo apt-get install -y r-cran-rjava Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: r-cran-rjava : Depends: r-api-3.5E: Unable to correct problems, you have held broken packages. `

The suggested newsgroup thread provided does not provide a good description of how to address the problem. Link found here: https://stat.ethz.ch/pipermail/r-sig-debian/2020-December/thread.html

From what I can tell, the only way to install r-cran-java with R v.4+, you need to do the following: sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+ sudo apt update sudo apt install r-cran-rjava

Instead of chastising the OP, it might have been helpful to have shared this first.

s-u commented 2 years ago

I cannot confirm you report, sudo apt-get install -y r-cran-rjava works out of the box on Ubuntu 20.04 as far as I can tell:

# docker run -it --rm ubuntu:20.04
$ grep VERSION /etc/os-release 
VERSION="20.04.3 LTS (Focal Fossa)"
VERSION_ID="20.04"
VERSION_CODENAME=focal
$ sudo apt-get install -y r-cran-rjava
Reading package lists... Done
Building dependency tree       
[...]
done.
$ Rscript -e 'library(rJava); .jinit(); J("java.lang.System")$getProperty("java.version")'
[1] "11.0.15"

If you are installing any non-standard binaries then that's up to you, but the point of the above was to provide instructions for users that are not familiar with the inner workings of unix. That said, the binary packages are maintained by the Debian/Ubuntu teams, not me.

pwaltman commented 2 years ago

Hmmm.... That's really odd. Technically, I'm doing this on Ubuntu 20.04, which is running under WSL. I can/will re-boot into native Ubuntu to verify, but so far as I understand it, Ubuntu v.20.04 under WSL is the same as native Ubuntu so far as the packages are concerned.

What version of R is installed on the docker image that you were testing on? For me, I'm running v.4.2, which might be the difference.

s-u commented 2 years ago

The above are all the commands - it's clean Ubuntu image, so r-cran-rjava installs all dependencies including R. If you install anything else manually (like a different R version) then you're on your own as you have to make sure your source provides working rJava (that's beyond my control) or you have to compile it yourself. Please refer to the R documentation and the README for further details.

pwaltman commented 2 years ago

Yeah, it looks like that's the issue. I'd forgotten that I'm running the R project's version of R, not the Ubuntu-blessed package, and it looks like I didn't add their repo for their corresponding CRAN packages, which you can do with:

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0

My bad.