Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find symbol 'sun.misc.Cleaner' on MacOS/Java 9 #1477

Closed
bendyarm opened this issue Nov 3, 2017 · 17 comments
Closed

Cannot find symbol 'sun.misc.Cleaner' on MacOS/Java 9 #1477

bendyarm opened this issue Nov 3, 2017 · 17 comments
Milestone

Comments

@bendyarm
Copy link

bendyarm commented Nov 3, 2017

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
@schildbach
Copy link
Member

What branch/tag/commit hash are you on?

@bendyarm
Copy link
Author

bendyarm commented Nov 3, 2017

master.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
$ git log | head -n 1
commit 9f5f973d8a41b3f97157939d38479d17b884ce21
$ 

@schildbach
Copy link
Member

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

@schildbach schildbach changed the title full build fails Cannot find symbol 'sun.misc.Cleaner' on MacOS/Java 9 Nov 8, 2017
@tompreston
Copy link

Hi,
I'm also getting stuck here. How do I tell maven to use Java 8? I've tried the sample here https://www.mkyong.com/maven/how-to-tell-maven-to-use-java-8/

like so:

diff --git a/pom.xml b/pom.xml
index 4a06e1eb..bd78d667 100644
--- a/pom.xml
+++ b/pom.xml
@@ -192,6 +192,8 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <generated.sourceDirectory>gen</generated.sourceDirectory>
+    <maven.compiler.target>1.8</maven.compiler.target>
+    <maven.compiler.source>1.8</maven.compiler.source>
   </properties>

   <profiles>

but I'm still seeing the error:

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

I'm not familiar with maven/JDK.

Thanks

@dbkingsb
Copy link
Contributor

Maven should be using $JAVA_HOME to choose which version of Java to use, however check to see if it is overwritten in ~/.mavenrc.

Here is an article about maven & java home & osx

@tompreston
Copy link

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.

@uneeb123
Copy link

Is Java 9 not supported?

@schildbach
Copy link
Member

FYI, there is a PR #1533 to migrate from Maven to Gradle.

I wonder if WindowsMMapHack.java can maybe simply be removed due to the underlying problem fixed in newer versions of Windows. If it needs to be kept, perhaps we should use reflection?

@shadders
Copy link

shadders commented Mar 13, 2018 via email

@schildbach
Copy link
Member

I added two tests (dbc4c35) that can hopefully aid to reproduce the original issue. Is there some volunteer running Windows?

@tofutim
Copy link

tofutim commented Apr 1, 2018

I have this issue on a Mac.
image

Matching Java Virtual Machines (3):
    1.8.0_161, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
    1.8.0_121, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
    1.7.0_71, x86_64:	"Java SE 7"	/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home

@schildbach
Copy link
Member

Resolved via 1700ec0.

I removed the mmap hack for Windows. Let's see if some of the Windows folks complain.

@oscarguindzberg
Copy link
Contributor

oscarguindzberg commented Dec 28, 2018

Has anybody checked "recover from seed" works on windows after the fix?

I added a test that fails:
oscarguindzberg@362684f

Environment:
AWS's Microsoft Windows Server 2016 Base
openjdk10

@schildbach
Copy link
Member

We should add the failing test to master.

@schildbach schildbach added this to the 0.15 milestone Feb 11, 2019
@oscarguindzberg
Copy link
Contributor

I added the test to #1695

@schildbach schildbach modified the milestones: 0.15, 0.16 Feb 15, 2019
@msgilligan
Copy link
Member

@schildbach I think we can close this one.

@schildbach
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants