Problem with xgboost installation - java.lang.NoClassDefFoundError: javax/tools/ToolProvider

Hello,

I’m trying to install XGBoost4J from source on macOS 10.13.5, and get the following error:

[ERROR] Caused by: java.lang.NoClassDefFoundError: javax/tools/ToolProvider

My environment info:

cmake version: 3.13.0-rc3
version: 0.81
java version: 9.0.1
echo $JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/
The commit hash (git rev-parse HEAD): 78ec77f

R sessionInfo():

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base

loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1

install log:
https://pastebin.com/AJ5vF4QZ

Steps to reproduce (hard reset to tagged release):

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git reset --hard 78ec77fa9787de69e4458e3f32f9d39ea1281955
cp make/config.mk ./config.mk
mkdir -p build
cd build
CC=gcc-8 CXX=g+±8 cmake …
make -j8
cd …/python-package/
sudo python setup.py install (installs python package without issues)
cd …/jvm-packages/
sudo mvn install

Anyone know what I’m doing wrong?

See https://github.com/scala/bug/issues/10603#issuecomment-397907443