Bloop doesn't use JAVA_HOME unless `--bloop-jvm system` is set (M1 mac)
See original GitHub issueVersion(s)
0.1.7, it’s been the case in earlier versions as well
Describe the bug
When using scala-cli v0.1.7 from the Releases page, even though JAVA_HOME points to an openjdk17, I still have to pass --bloop-jvm system
for it to use what JAVA_HOME points to.
I believe https://github.com/VirtusLab/scala-cli/pull/781 was supposed to solve this problem, but for some reason… doesn’t. It still uses temurin in an x86 variant even though it’s running on an M1 mac.
Here’s the output of $JAVA_HOME/bin/java -version
I’m getting.
openjdk version "17.0.3" 2022-04-19 LTS
OpenJDK Runtime Environment Zulu17.34+19-CA (build 17.0.3+7-LTS)
OpenJDK 64-Bit Server VM Zulu17.34+19-CA (build 17.0.3+7-LTS, mixed mode, sharing)
To Reproduce
- Get openjdk17 from zulu (e.g. from Nixpkgs)
- Get the scala-cli binary: https://github.com/VirtusLab/scala-cli/releases/download/v0.1.7/scala-cli-x86_64-apple-darwin.gz
export JAVA_HOME=<wherever the jdk is>
- Create a
foo.sc
file with anything ./scala-cli compile foo.sc
- Check running processes to see which JVM is used
Expected behaviour
The JVM that JAVA_HOME points to is used.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
scalacenter/bloop - Gitter
I'm trying VS Code + Metals + Bloop. The program I'm using instantiates scalac and calls it (to generate code). This works just...
Read more >Build Server Reference · Bloop - Scala Center
The java binary should exist in $JAVA_HOME/bin/java . The Bloop server will not start correctly if the javaHome field points directly to the...
Read more >Installation - Coursier
These instructions will install the coursier CLI cs itself, as well as a typical Scala ... They will also install a JVM if...
Read more >Apple silicon(M1) 11.4 get a java error (jdk16) - Stack Overflow
The mvn formula in brew seems to prefer always using openjdk formula even with openjdk@11 ...
Read more >Emacs | Metals - Scalameta
Eclipse OpenJ9 is not supported, please make sure the JAVA_HOME environment variable points to a valid Java 8, 11 or 17 installation. macOS,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for reporting @kubukoz, there was a problem that scala-cli couldn’t resolve
JAVA_HOME
for a native launcher built by GraalVM, because ScalaCLI readjava.home
from properties which returnNone
.So we fixed it and now scala-cli read
JAVA_HOME
from path, and then if not found, then try to findJAVA_HOME
in properties.In the next version of scala-cli
0.1.8
it should be fixed 1084.If you want to test it now, you can download snapshot native launcher of Scala CLI from Artifacts.
It’s all good in 0.1.8, thanks 😃