0

I want to use the "coreNLP" library in R software. I am using ubuntu, and the java version is 11.0.4.

I have an error during using the initCoreNLP()

Error in rJava::.jnew("edu.stanford.nlp.pipeline.StanfordCoreNLP", basename(path)) :

I tried to solve this problem by using the dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/server/libjvm.dylib')

Then remove rJava and reinstall it again. However, when I use the dyn.load in R, it gives me this error

ibjvm.dylib: cannot open shared object file: No such file or directory

when I tried to check that if the file is existed by using the below command

ls /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home

it show that the 'jre/lib/server/libjvm.dylib' is not exist

NOTe::

I do not have any problem when I use library(rJava)

also, I used the /usr/lib/jvm/java-11-openjdk-amd64/lib/server directory to export it in LD_LIBRARY_PATH because it has the libjvm.so file

what should I do now to solve this problem????

programmer
  • 577
  • 1
  • 9
  • 21

1 Answers1

0

.dylib is an extension for macOS shared based libraries. If you are using Ubuntu it will be .so

So, it looks like you have sort of mixed environment. In fact, this layout

/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home

seems like macOS one.

Anyway. I suggest starting from the very beginning. Try to:

  • configure Java in R using sudo R CMD javareconf

  • install rJava using `install.packages('rJava')

  • make sure your Java + R env. is running fine. I suggest running simple code before jumping towards something more complex. For example:

http://www.owsiak.org/running-java-code-in-r/

  • make sure your coreNLP is visible from R - e.g. it's JAR files are on CLASSPATH
Oo.oO
  • 12,464
  • 3
  • 23
  • 45