Code Monkey home page Code Monkey logo

Comments (8)

eylenth avatar eylenth commented on July 26, 2024 1

R CMD javareconf didn't work as well..

Maybe I have to rebuild the whole R module with Java 16 (or 17)
But I will do that another time. that R module is quite large with a lot of dependencies which requires some time to rebuild

I will close this ticket for now, and I will create a new one if needed

from xlsx.

colearendt avatar colearendt commented on July 26, 2024

Interesting! I'm not sure! I will give this a check.

It's worth noting that you should be able to test the new version of embedded Java bits if you run:

remotes::install_github("colearendt/xlsx@bump-poi")

If this is indeed an "old version of the Apache POI library" issue, that should resolve it. However, I do not yet have all the kinks sorted out of that branch yet, so some functionality does not work.

I would be curious to hear what you find though!

from xlsx.

eylenth avatar eylenth commented on July 26, 2024

I'm getting the following error message when I try to install the bump-poi version:

Installing package into ‘$install_dir/R-bundle-extra/4.0.3-foss-2020b-R-4.0.3’
(as ‘lib’ is unspecified)
* installing *source* package ‘xlsx’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in .jcheck() : No running JVM detected. Maybe .jinit() would help.
Error: unable to load R code in package ‘xlsx’
Execution halted
ERROR: lazy loading failed for package ‘xlsx’
* removing $install_dir/R-bundle-extra/4.0.3-foss-2020b-R-4.0.3/xlsx’
Error: Failed to install 'xlsx' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmp2hQPu2/file298fd4b653d78/xlsx_0.6.5.9100.tar.gz’ had non-zero exit status
> .jinit()
Error in .jinit() : could not find function ".jinit"
> .jcheck()
Error in .jcheck() : could not find function ".jcheck"

from xlsx.

colearendt avatar colearendt commented on July 26, 2024

Apologies for the late reply here. It sounds like some progress here though!

So the .jinit() function is in the rJava package. Maybe try:

rJava::.jInit()
# or
library(rJava)
.jinit()

from xlsx.

eylenth avatar eylenth commented on July 26, 2024

I'm getting the following output:

> rJava::.jInit()
Error: '.jInit' is not an exported object from 'namespace:rJava'
> library(rJava)
> .jinit()
[1] 0

then I tried to install the xlsx bump-poi version again, but I'm getting the same error message

from xlsx.

colearendt avatar colearendt commented on July 26, 2024

(Sorry for the typo on the first .jinit(). Probably auto-correct got me). The "no running jvm detected" message? Maybe try this?

library(rJava)
.jinit()
.jcheck()
.jstrVal('hello')

Something weird is going on in your JVM, it seems like!

from xlsx.

eylenth avatar eylenth commented on July 26, 2024

I'm getting the following output:

> library(rJava)
> .jinit()
> .jcheck()
> .jstrVal('hello')
[1] "hello"
> 

from xlsx.

colearendt avatar colearendt commented on July 26, 2024

Weeeird! So now that looks totally normal!! Ok, so I did a bit of testing and this looks like it works (even w/ the CRAN release of xlsx) in a vanilla container. Can you share the output of R CMD javareconf?:

# R CMD javareconf
Java interpreter : /opt/java/openjdk/bin/java
Java version     : 16.0.1
Java home path   : /opt/java/openjdk
Java compiler    : /opt/java/openjdk/bin/javac
Java headers gen.:
Java archive tool: /opt/java/openjdk/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"/opt/R/4.0.5/lib/R/include" -DNDEBUG -I/opt/java/openjdk/include -I/opt/java/openjdk/include/linux  -I/usr/local/include   -fpic  -g -O2  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/opt/R/4.0.5/lib/R/lib -L/usr/local/lib -o conftest.so conftest.o -L/opt/java/openjdk/lib/server -ljvm -L/opt/R/4.0.5/lib/R/lib -lR


JAVA_HOME        : /opt/java/openjdk
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 /opt/R/4.0.5/lib/R
Done.

If you're on linux, you could also try:

find / -name 'libnio.so'
# /opt/java/openjdk/lib/libnio.so
ldd $( find / -name 'libnio.so' )
# ldd: warning: you do not have execution permission for `/opt/java/openjdk/lib/libnio.so'
#       linux-vdso.so.1 =>  (0x00007fff7a8d0000)
#       libjava.so => /opt/java/openjdk/lib/libjava.so (0x00007f9ef1f95000)
#       libnet.so => /opt/java/openjdk/lib/libnet.so (0x00007f9ef1d7f000)
#       libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9ef1b63000)
#       libdl.so.2 => /lib64/libdl.so.2 (0x00007f9ef195f000)
#       libc.so.6 => /lib64/libc.so.6 (0x00007f9ef1591000)
#       /lib64/ld-linux-x86-64.so.2 (0x00007f9ef23cf000)
#       libjvm.so => not found
#       libjvm.so => not found

I'm wondering if there is something weird in your Java install (i.e. why that ipv4_address variable is missing)

The container I'm using, in case it is helpful:

Dockerfile

FROM adoptopenjdk/openjdk16:jdk-16.0.1_9-centos

ARG R_VERSION=4.0.5
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
  curl -O https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm && \
  yum install -y R-${R_VERSION}-1-1.x86_64.rpm && \
  /opt/R/${R_VERSION}/bin/R --version && \
  ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R && \
  ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript

Then:

docker build -f Dockerfile -t java-r .
docker run -it --rm java-r bash
R CMD javareconf
R -e 'install.packages("xlsx", repos = "https://cran.rstudio.com"); library(xlsx); xlsx::createWorkbook()'
# works fine

It's worth noting that Java weirdness is one reason that many people bail on xlsx (and rJava in general) 😞 R CMD javareconf is probably the most common fix, but it looks like your java install may have an issue.

from xlsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.