本文介绍了无法初始化编译器:在编译器镜像中找不到对象java.lang.Object的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Ubuntu 16.04上,我安装了scala
:
On Ubuntu 16.04, I installed scala
:
$ls ~/Binary/scala-2.11.8
bin doc lib man
$grep -A 2 SCALA ~/.bashrc
SCALA=~/Binary/scala-2.11.8
SBT=~/Binary/sbt
export PATH=$PATH:$SCALA/bin:$SBT/bin
在安装openjdk8
的情况下,打开REPL时scala
失败:
With openjdk8
installed, scala
fails when opening the REPL:
$javac -version
javac 1.8.0_91
$
$scala
Welcome to Scala 2.11.8 (OpenJDK 64-Bit Server VM, Java 9-internal).
Type in expressions for evaluation. Or try :help.
scala>
Failed to initialize compiler: object java.lang.Object in compiler mirror not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programmatically, settings.usejavacp.value = true.
Failed to initialize compiler: object java.lang.Object in compiler mirror not found.
** Note that as of 2.8 scala does not assume use of the java classpath.
** For the old behavior pass -usejavacp to scala, or if using a Settings
** object programmatically, settings.usejavacp.value = true.
我该如何解决?
推荐答案
使用Java 8版本的OpenJDK为我解决了此问题.
Using the Java 8 version of OpenJDK resolved this issue for me.
sudo update-alternatives --config java
sudo update-alternatives --config javac
这篇关于无法初始化编译器:在编译器镜像中找不到对象java.lang.Object的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!