bitcoinj: Cannot find symbol 'sun.misc.Cleaner' on MacOS/Java 9

I followed the instructions for a full build but I got a compilation error. MacOS 10.13.1 Java version: 9.0.1 Apache Maven 3.5.2 git clone …bitcoinj mvn clean package

Here’s the relevant output:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project bitcoinj-core: Compilation failure
[ERROR] [snipped]/bitcoinj/core/src/main/java/org/bitcoinj/store/WindowsMMapHack.java:[36,9] cannot find symbol
[ERROR]   symbol:   class Cleaner
[ERROR]   location: class org.bitcoinj.store.WindowsMMapHack

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Can you try Java 8? Seems like the sun.misc.Cleaner class was removed.

That’s right. The test Oscar mentioned was merged.

Thanks @dbkingsb, that article was really useful. I installed JDK 8 and changed my ~/.mavenrc:

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    9.0.1, x86_64:	"Java SE 9.0.1"	/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home
    1.8.0_151, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home

$ cat ~/.mavenrc
JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_151`

wallet-tool builds now.