我对 Scala 和JVM编程完全陌生.我最近加入的团队使用scala来构建要在Spark上运行的程序.工作中的堆栈稳定且功能正常,但其复杂性与我在家里的需求不符:仅仅是拥有功能性Scala外壳的人在添加任何"环境复杂性"
I am a complete noob on Scala and JVM programming. The team I recently joined uses scala to build programs to be run on Spark. The stack at work is stable and functional but its complexity does not match the needs I have at home: merely the one to have a functional scala shell to get a bit more familiar with the language, try things, get the syntax right before adding any "environmental complexity"
[注意]我只想让某些东西与此文档(因此,请不要根据编译器,sbt,IDE等来回答)
[NOTE] I just want something dumb in the same vein of this documentation (so, please not answer based on compilers, sbt, IDE, etc etc)
david@ripper$ java -version openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) david@ripper$ scala -version Scala code runner version 2.11.8 -- Copyright 2002-2016, LAMP/EPFL这是我吃午餐时得到的东西
Here is what I get when lunching the shell
david@ripper$ scala Exception in thread "main" java.lang.NoClassDefFoundError: javax/script/Compilable at scala.tools.nsc.interpreter.ILoop.createInterpreter(ILoop.scala:118) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:911) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909) at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97) at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:909) 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)这似乎是一个经典问题,尽管我首先与系统上安装了 Oracle Java 11 有关.但是,我认为我使用以下命令将openjdk8设置为默认的,系统范围的JRE:
It seems like a classical issue I first though related with the fact that I have an Oracle java 11 installed on my system. However, I thought that I made openjdk8 is the default, system-wide JRE with this:
update-alternatives --config java Il existe 2 choix pour l'alternative java (qui fournit /usr/bin/java). Sélection Chemin Priorité État ------------------------------------------------------------ 0 /usr/lib/jvm/java-11-oracle/bin/java 1091 mode automatique 1 /usr/lib/jvm/java-11-oracle/bin/java 1091 mode manuel * 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 mode manuel我想念的是什么.不是使用/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 标量.我正在使用 Debian 9
What am I missing. Isn't scala using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java. I am using the default scala package provided in Debian 9
推荐答案结果是, update-alternatives --config java 并没有更改用户PATH的 JAVA_HOME (仍然指向java11).似乎scala-shell不使用系统的默认JRE,而是使用一个.bashrc(在我的情况下为.zshrc)指向.
Turns out, update-alternatives --config java did not change the JAVA_HOME of the user's PATH (which still pointed to java11). It seems that the scala-shell does not use the system's default JRE but, rather, the one .bashrc (in my case .zshrc) points to.
更多推荐
scala EPFL线程“主"中的异常java.lang.NoClassDefFoundError:javax/script/Compilable
发布评论