How change CurrentJDK symbolic link in MacOS

前端 未结 3 1998
陌清茗
陌清茗 2021-01-06 15:40

Currently in my Mac I have these JAVA versions:


MyMac$ cd /Library/Java/JavaVirtualMachines

$ ls -la

total 0

drwxr-xr-x 4 root wheel

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 16:05

    Steps that worked on macOS Catalina 10.15.2 and RStudio 1.2.5036

    Install Java 11.0.1 from here (requires free account):

    https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase11-5116896.html

    Run javareconf

    You probably need to run the command below, but RStudio seems not acknowledge the settings:

    sudo R CMD javareconf 
    

    Remove (if installed) and reinstall rJava from source

    remove.packages("rJava") 
    install.packages("rJava", type="source", repos="http://cran.rstudio.com")
    

    Installing rJava from source seems to run a different configuration setup that will look for Java and it will display "checking Java support in R" as part of the output that seems accepted by RStudio.

    Change ~/.Rprofile

    This change to .Rprofile may also be necessary:

    options(java.home="/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home")
    Sys.setenv(DYLD_FALLBACK_LIBRARY_PATH="/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/")
    

提交回复
热议问题