question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected JDK detection error in macOS

See original GitHub issue

“To use Java command-line tools you need to install a JDK”

Here’s what I do:

➜  ~ bloop server
Defaulting on nailgun port 8212
There is no server running at port 8212
Starting the bloop server... this may take a few seconds
Running /usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server as a jar...
Shelling out with '['java', '-jar', '/usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server']' ...
Error: Invalid or corrupt jarfile /usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server
Running /usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server as a script...
Shelling out in Unix system with ['sh', '/usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server']
Detected java options are ''
Unable to find any JVMs matching version "1.8".
No Java runtime present, requesting install.
Bloop server in /usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server failed to run.
First invocation attempt: ['java', '-jar', '/usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server']
-> Return code: 1
Second invocation attempt: ['sh', '/usr/local/Cellar/bloop/1.4.0-RC1/bin/blp-server']
-> Return code: 2
➜  ~ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
➜  ~ echo $JAVA_HOME
/Users/jules.ivanic/.sdkman/candidates/java/current

When, I’m launching the bloop server command the following Macos popup shows up: Screenshot 2020-01-21 12 09 19

I installed the JDK with SDKMAN (https://sdkman.io/). My JAVA_HOME is correctly set.

How can I fix that?

Thanks, Jules

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
jvicancommented, Jan 25, 2020

Thanks for reporting @guizmaii. This issue happens because /usr/libexec/java_home doesn’t support sdkman. @ahjohannessen has also reported the same issue in Discord.

I plan to fix this by getting rid of java_home in the macOS brew formula so that we don’t force JDK 8 on macOS. This is a thing inherited from the past where bloop didn’t support JDK 11 and where I was wary of supporting JDK 11 over JDK 8 because it produces slower compilation. That will change in the release of v1.4.0.

3reactions
zingmanecommented, Oct 28, 2020

Setting $HOME/.bloop/bloop.json hasn’t worked for me (macOS)

But that fixed it:

  • brew uninstall bloop (1.4.4)
  • set SDK pathexport JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home"
  • reinstall brew install bloop
  • first call fails again bloop exit
  • second call (also starts the server) bloop about
  • everything working as expected again 🎉🤷‍♂️
> bloop about
bloop v1.4.4

Using Scala v2.12.8 and Zinc v1.3.0-M4+45-d4354be3
Running on Java JDK v11.0.2 (/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home)
  -> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center (Jorge Vicente Cantero, Martin Duhem)
Read more comments on GitHub >

github_iconTop Results From Across the Web

MAC A fatal error has been detected by the Java Runtime ...
Try to use a shell terminal and type in: export LD_BIND_NOW=1.
Read more >
Known Issues for JDK 8 - Oracle
This document describes known issues in the Oracle JDK 8 release.
Read more >
Java Control Panel quit unexpectedly whil… - Apple Community
Java Control Panel quit unexpectedly while using the libjvm.dylib plug-in. ... OS X Server1 0.8.4, Mac Mini (5,1), Java 7u25 (jre-7u25-macosx-x64.
Read more >
How to Fix UnsupportedClassVersion Error in Java - Rollbar
The UnsupportedClassVersionError in Java occurs when the JVM attempts to read a malformed or otherwise erroneous class file.
Read more >
Change the boot Java runtime of the IDE | IntelliJ IDEA ...
Changing the boot Java runtime may cause unexpected problems. ... IntelliJ IDEA lists all the JDKs and JREs that it was able to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found