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

半世苍凉 提交于 2019-11-30 04:14:51
trianta2

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!