Scala REPL启动错误“类文件已损坏”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18842985/
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
Scala REPL startup error "class file is broken"
提问by Yehor Nemov
Every time after starting Scala 2.9.2 REPL (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea) first line of code executing bring me an error:
每次启动 Scala 2.9.2 REPL (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0-ea) 后第一行代码执行都会给我一个错误:
scala> 1 + 2
error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
(bad constant pool tag 15 at byte 1484)
Later during further evaluation in current REPL instance no similar errors are occured.
稍后在当前 REPL 实例的进一步评估期间没有发生类似的错误。
Has anyone any suggestion how to handle this behaviour?
有没有人有任何建议如何处理这种行为?
回答by Chemaclass
Try to select other alternative provider java:
尝试选择其他替代提供程序 java:
$ sudo update-alternatives --config java
There are some choices for the alternative java (providing /usr/bin/java).
替代java有一些选择(提供/usr/bin/java)。
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
* 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1065 manual mode
Press enter to keep the current choice[*], or type selection number:
EDITED: Scala is now abailable for Java 8 :-)
编辑:Scala 现在可用于 Java 8 :-)
see http://www.scala-lang.org/news/2013/09/18/release-notes-v2.10.3-RC2.html
见http://www.scala-lang.org/news/2013/09/18/release-notes-v2.10.3-RC2.html

