신사(SinSa)

우선 R 버전을 sessionInfo()로 확인하고 여기서 최신버전 설치

최신 버전 설치 후 터미널에서

sudo R CMD javareconf

sudo R CMD javareconf

입력 후 JAVA_HOME Path 정보를 복사해두었다가

R에 아래 항목에 입력

Sys.setenv("JAVA_HOME" = '/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre')
dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre/lib/server/libjvm.dylib')

그럼에도 불구하고 아래와 같은 에러가 나면

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.6/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
  Reason: image not found

터미널에 아래와 같이 입력해주면 잘 됨

sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
profile

신사(SinSa)

@신사(SinSa)

포스팅이 좋았다면 "좋아요❤️" 눌러주세요!