spark-class:第71行...没有此类文件或目录 [英] spark-class: line 71...No such file or directory
问题描述
我已经在Ubuntu上安装了Spark 2.1.1,无论我做什么,它似乎都与java路径不一致.当我运行"spark-submit --version"或"spark-shell"时,出现以下错误:
I've installed Spark 2.1.1 on Ubuntu and no matter what I do, it doesn't seem to agree with the java path. When I run "spark-submit --version" or "spark-shell" I get the following error:
/usr/local/spark/bin/spark-class:第71行:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin//bin/java:无此类文件或目录
现在显然"/bin//bin/java"是有问题的,但是我不确定在哪里更改配置. spark-class文件包含以下几行:
Now obviously the "/bin//bin/java" is problematic, but I'm not sure where to change the configuration. The spark-class file has the following lines:
if [ -n "${JAVA_HOME}" ]; then
RUNNER="${JAVA_HOME}/bin/java"
我最初使用的是适用于Hadoop 2.4的Spark版本,当我将其更改为"RUNNER ="$ {JAVA_HOME}"时,它会给我错误消息[[path] is a directory或" [path]不是目录."这是在/etc/environment中尝试了多个路径排列之后
I was originally using a version of Spark meant for Hadoop 2.4 and when I changed it to "RUNNER="${JAVA_HOME}" it would either give me the error "[path] is a directory" or "[path] is not a directory." This was after also trying multiple path permutations in /etc/environment
我现在在/etc/environment中拥有的是:
What I now have in /etc/environment is:
JAVA_HOME ="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/"
这是我当前拥有的Java设置:
This is the current java setup that I have:
r oot @ ubuntu:〜#update-alternatives --config java 链接组java(提供/usr/bin/java)只有一种选择:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
root@ubuntu:~# update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
bashrc具有以下内容:
bashrc has the following:
export SPARK_HOME="/usr/local/spark"
export PATH="$PATH:$SPARK_HOME/bin"
任何人都可以建议:1)我需要更改哪些文件,以及2)我需要如何更改它们?预先感谢.
Can anyone advise: 1) What files I need to change and 2) how I need to change them? Thanks in advance.
spark-class文件在链接中,以防万一:
spark-class file is in the link, just in case:
http://vaughn-s.net/hadoop/spark-class
推荐答案
在/etc/environment文件中替换
In the /etc/environment file replace
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/
与
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/
然后执行
source /etc/environment
RUNNER="${JAVA_HOME}/bin/java"
也应保持不变
这篇关于spark-class:第71行...没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!