I've looked through a lot of rJava issues and tried a lot of things (the ones I could understand at least). I updated to R 3.5 yesterday and my rJava/xlsx packages can't seem to work. The install doesn't show any errors, but when I try to load it in with library, I get the following error:
> Error: package or namespace load failed for ‘rJava’: .onLoad failed
> in loadNamespace() for 'rJava', details: call: dyn.load(file,
> DLLpath = DLLpath, ...) error: unable to load shared object
> '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
> dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so,
> 6): Library not loaded:
> /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
> Referenced from:
> /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
> Reason: image not found
The .so file does exist in the spot it seems to be looking . . . I've tried doing the sudo R CMD javareconf in Terminal, but no luck. JAVA_HOME is shown as /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre. I'm on a Macbook with High Sierra 10.13.4.
Followed the instructions in the recommended post, but it seems to have led to RStudio launching with R 3.4 rather than 3.5 which has it back to operational for me, but R 3.5 still does not load xlsx.