2

I did

brew install scala
brew install sbt

scala works fine for me, however when I try to run sbt, I get:

⇒  sbt
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script

No java installations was detected.
Please go to http://www.java.com/getjava/ and download


siddhartha@Siddharthas-MacBook-Pro-2:~|
⇒  echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

I checked the following 2 links but neither have a helpful answer:

No Java installation was detected while sbt update

Why does sbt report "No java installations was detected" with $JAVA_HOME set?

Any help appreciated.

Siddhartha
  • 4,296
  • 6
  • 44
  • 65

2 Answers2

1

My solution was to do a sudo. I suppose permissions for sbt in /usr/local are set for root when installed via brew.

Siddhartha
  • 4,296
  • 6
  • 44
  • 65
0

The sbt script that launches java (sbt-launch-lib.bash) prints “No java installations was detected” (now “No Java Development Kit (JDK) installation was detected.”) if there is any error running java -version with the current environment variables JAVA_TOOL_OPTIONS, _JAVA_OPTIONS. So if either of these variables contains impossible options, sbt will give the misleading error instead of the actual error.

JAVA_TOOL_OPTIONS or _JAVA_OPTIONS might be misconfigured to have a too large memory usage (e.g. -Xms100g). Or it might be misconfigured to listen to a debug port (e.g. -agentlib:jdwp=transport=dt_sockerver=y,suspend=n,address=5005) that is already bound by another program.

The sbt script applies JAVA_OPTS and SBT_OPTS only after checking java -version, so if you set those instead, then you may get a better error message.

yonran
  • 18,156
  • 8
  • 72
  • 97