Problem: Trying to call library(“xlsx”) throws error message indicating that JDK path cannot be found, but you have Java already installed. Your version is more recent than what the package is expecting. You attempt to update your system/IDE so that calls for JDK now point to the newer version

$ sudo R CMD javareconf

— but you get the following error message

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Issue: (1) Many IDEs and programming language packages rely on differing developer versions than might be installed on your OS. For example,  if you upgraded your Java from 9 to 10, and an R-package (such as ‘rJava’ or ‘XLSX’) was built so as to specifically call on directories with the name “/Library/Java/JavaVirtualMachines/jdk-9.jdk/”. (2) You must have:

  1. install_name_tool
  2. This requires Command Line Tools for Xcode installed/downloaded from Apple


  • Ensure you have Java (jdk) installed.

$ java -version

$ sudo R CMD javareconf

  •  QUIT & RESTART RStudio