Closed guizmaii closed 1 month ago
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.
I'm guessing it's the same underlying issue, but I get similar output trying to run bloop server
and I'm not using sdkman, nor is $JAVA_HOME
set. I also have JDK 13.
$ 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".
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 "13.0.1" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.1+9, mixed mode, sharing)
$ echo $JAVA_HOME
Note the lack of "No Java runtime present, requesting install." and GUI popup as described in the OP.
JDK 13 is not supported, please check docs for more info.
I'm also seeing this "Invalid or corrupt jarfile" warning. As far as I can tell everything is working fine though.
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 load nailgun-version.properties.
NGServer [UNKNOWN] started on address localhost/127.0.0.1 port 8212.
Don't worry about that, that's expected, it's a bening error
It's an error that will be gone in the next release btw @jsatk it's caused by the python client that starts up the server
@jvican Does this PR https://github.com/scalacenter/bloop/pull/1196 fix the problem reported here?
Yup, the launcher should already be working on these environments. Our next release deprecates the bloop python client that you are currently using and will use the launcher exclusively, which means both of these issues will be gone in 1.4.0
Yup, the launcher should already be working on these environments.
Maybe I misunderstood what you mean by "the launcher should already be working on these environments". 🤔
It's an error that will be gone in the next release btw @jsatk it's caused by the python client that starts up the server
Thanks for the explanation @jvican.
When I see scary errors I tend to think I've done something wrong 😆.
@guizmaii Yes, that is not the launcher, that is the installer. Long story short, bloop 1.4.0 will update the installation methods so that you don't see that anymore! Will elaborate more on this point in the release notes
@jsatk That's a totally reasonable expectation, I agree the script should not be showing that error when it's benign.
Am I right that the workaround for now if I must have JDK11 locally would be as follows:
1) Clone the project (since the fix is already there, just haven't been published yet)
2) Switch to JDK8
3) Build bloop
and then install it locally
4) Switch to JDK11
5) Start compiling projects using bloop + JDK11
?
@igor-ramazanov Since https://github.com/scalacenter/bloop/pull/1203 you can globally configure the Java version for bloop in $HOME/.bloop/bloop.json
. Docs
https://scalacenter.github.io/bloop/docs/server-reference#custom-java-home
This option is respected regardless if you use bloopgun (the new bloop
cli), Metals or IntelliJ
@olafurpg Thank you so much for the quick answer! I haven't tried it yet, but will do tomorrow and let you know if it works out. Thank you and stay healthy ✊
@olafurpg Is it normal that when I configure the custom java home is the bloop.json
, I still have this problem: https://github.com/scalacenter/bloop/issues/1150#issuecomment-603561109?
I have never seen that message. The custom java home is only respected in the latest nightly build, the homebrew is older. How are you launching bloop?
brew start bloop
The brew formula is using an old Bloop version. You can start a Bloop server with the latest version like this
brew services stop bloop
bloop exit
cs launch ch.epfl.scala:bloopgun-core_2.12:1.4.0-RC1-162-888454e1 -- help
bloop help
@olafurpg
I tried the #1204 (not thoroughly) and failed to properly setup it having the same couldn't find JDK 1.8
error.
I wrote personal bash scripts using coursier
to run bloop as you showed in the above message.
Setting $HOME/.bloop/bloop.json
hasn't worked for me (macOS)
But that fixed it:
brew uninstall bloop
(1.4.4)export JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home"
brew install bloop
bloop exit
bloop about
> 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)
I followed your steps and it also fixed my issues @zingmane thank you!
I don't think this is still relevant, we can open a specific issue if the new behaviour is not working
"To use Java command-line tools you need to install a JDK"
Here's what I do:
When, I'm launching the
bloop server
command the following Macos popup shows up:I installed the JDK with SDKMAN (https://sdkman.io/). My
JAVA_HOME
is correctly set.How can I fix that?
Thanks, Jules