java spark-class:第 71 行...没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43834670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:45:21  来源:igfitidea点击:

spark-class: line 71...No such file or directory

javaubuntuapache-spark

提问by lengthy_preamble

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:

我已经在 Ubuntu 上安装了 Spark 2.1.1,无论我做什么,它似乎都不符合 java 路径。当我运行“spark-submit --version”或“spark-shell”时,出现以下错误:

/usr/local/spark/bin/spark-class: line 71: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin//bin/java: No such file or directory

/usr/local/spark/bin/spark-class:第 71 行:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin//bin/java:没有那个文件或目录

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:

现在显然“/bin//bin/java”有问题,但我不确定在哪里更改配置。spark-class 文件有以下几行:

if [ -n "${JAVA_HOME}" ]; then
  RUNNER="${JAVA_HOME}/bin/java"

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

我最初使用的是用于 Hadoop 2.4 的 Spark 版本,当我将其更改为“RUNNER="${JAVA_HOME}”时,它会给我错误“[path] is a directory”或“[path] is not a目录。”这是在 /etc/environment 中尝试多个路径排列之后

What I now have in /etc/environment is:

我现在在 /etc/environment 中有:

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/"

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/"

This is the current java setup that I have:

这是我当前的 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

r oot@ubuntu:~# update-alternatives --config java 链接组 java 中只有一种选择(提供 /usr/bin/java):/usr/lib/jvm/java-8-openjdk-amd64/jre/二进制/Java

bashrc has the following:

bashrc 具有以下内容:

export SPARK_HOME="/usr/local/spark"
export PATH="$PATH:$SPARK_HOME/bin"

Can anyone advise: 1) What files I need to change and 2) how I need to change them? Thanks in advance.

任何人都可以建议:1)我需要更改哪些文件以及 2)我需要如何更改它们?提前致谢。

spark-class file is in the link, just in case:

spark-class 文件在链接中,以防万一:

http://vaughn-s.net/hadoop/spark-class

http://vaughn-s.net/hadoop/spark-class

回答by shahin

In the /etc/environment file replace

在 /etc/environment 文件中替换

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/ 

with

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/

then execute

然后执行

source /etc/environment 

also RUNNER="${JAVA_HOME}/bin/java"should be kept as it is

RUNNER="${JAVA_HOME}/bin/java"应该保持原样

回答by dusa bhargava

Windows Environment:

视窗环境:

Open Advanced system settings -> Environment Variablesto set JAVA_HOMEpath, and the most common mistake is setting the path to JAVA folder:

打开Advanced system settings -> Environment Variables设置JAVA_HOME路径,最常见的错误是设置了JAVA文件夹的路径:

JAVA_HOME: Directory-Name:\java

rather than setting it to JDK folder

而不是将其设置为 JDK 文件夹

JAVA_HOME: Directory-Name:\jdk

This is how it worked for me.

这就是它对我的工作方式。