Getting “cat: /release: No such file or directory” when running scala

前端 未结 3 926
无人共我
无人共我 2020-12-29 02:26

I tried to install Scala 2.12.1 on my Mac (El Capitan) via Homebrew and also by downloading the binaries from https://www.scala-lang.org/download/.

In b

相关标签:
3条回答
  • 2020-12-29 02:42

    Try setting your JAVA_HOME environment variable. In my case, JAVA_HOME was already set.

    I got the error specifically

    cat: /usr/lib/jvm/java-8-openjdk-amd64/release: No such file or directory
    

    I got it fixed by creating an empty file release in it

    sudo touch $JAVA_HOME/release
    

    My JAVA_HOME looks like

    $ echo $JAVA_HOME
    /usr/lib/jvm/java-8-openjdk-amd64`
    

    That's a hack, but it just works fine for me!

    There doesn't seem to be any hard doing that also if you look at what does happen with this /release file while running scala; https://github.com/scala/scala/pull/5588/files.

    Caution: This solution is only applicable when you don't have release file in place.

    0 讨论(0)
  • 2020-12-29 03:00

    Opening up bin/scala, there's a line:

    java_release="$(cat $JAVA_HOME/release | grep JAVA_VERSION)"
    

    My $JAVA_HOME wasn't set. All fixed now.

    0 讨论(0)
  • 2020-12-29 03:05

    I would add this as a comment but can't as of yet due to my newbie status. To specifically fix your $JAVA_HOME - if you're on UNIX you can copy and paste this in to your Terminal:

    export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"

    Replace the 1.8 with whatever version of Java you are currently working from.

    0 讨论(0)
提交回复
热议问题