问题
执行计算时,抛出异常:
...
java.lang.IllegalArgumentException: Unsupported class file major version 57
...
经过查询,发现时pyspark jar 包相比运行时java环境的版本太低,于是试图降低java运行时环境的版本。
原因
由于一开始在mac下,执行
$ brew cask install java
...
java was successfully installed!
查看java
版本是 java 13
$ java -version
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment (build 13.0.1+9)
OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
于是删除 java13
版本的运行时环境
解决
$ brew tap AdoptOpenJDK/openjdk
然后输入:
$ brew cask install adoptopenjdk8
Error: Cask adoptopenjdk8 exists in multiple taps:
homebrew/cask-versions/adoptopenjdk8
adoptopenjdk/openjdk/adoptopenjdk8
于是:
$ brew cask install homebrew/cask-versions/adoptopenjdk8
adoptopenjdk8 was successfully installed!
安装成功,查看版本号:
$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)