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.

Bloop doesn't use JAVA_HOME unless `--bloop-jvm system` is set (M1 mac)

See original GitHub issue

Version(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

  1. Get openjdk17 from zulu (e.g. from Nixpkgs)
  2. Get the scala-cli binary: https://github.com/VirtusLab/scala-cli/releases/download/v0.1.7/scala-cli-x86_64-apple-darwin.gz
  3. export JAVA_HOME=<wherever the jdk is>
  4. Create a foo.sc file with anything
  5. ./scala-cli compile foo.sc
  6. Check running processes to see which JVM is used

Expected behaviour

The JVM that JAVA_HOME points to is used.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lwronskicommented, Jun 14, 2022

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 read java.home from properties which return None.

So we fixed it and now scala-cli read JAVA_HOME from path, and then if not found, then try to find JAVA_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.

0reactions
kubukozcommented, Jun 15, 2022

It’s all good in 0.1.8, thanks 😃

Read more comments on GitHub >

github_iconTop 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 >

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