我正在尝试在Ubuntu 16.04.3
上启动scala。我安装了java和scala,但是当我在终端中输入scala时,它会突然抛出异常。
首先,我按照How to install java中描述的步骤安装了Java:
- $sudo apt-get update
- $sudo apt-get install default-jre
- $sudo apt-get install default-jdk
- $sudo add-apt-repository ppa:webupd8team/java
- $sudo apt-get update
- $sudo apt-get install oracle-java9-installer
当我输入$java -version
时,我得到:
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
其次,我使用以下命令$sudo apt-get install scala
当我输入$scala
时,从控制台我得到以下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/script/Compilable
at scala.tools.nsc.interpreter.ILoop.createInterpreter(ILoop.scala:126)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:908)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:906)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:906)
at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:906)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)