Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
133 views
in Technique[技术] by (71.8m points)

java - Scala repl throws error

When I type scala on the terminal to start the repl, it throws this error

scala> [init] error: error while loading AnnotatedElement, 
class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar
(java/lang/reflect/AnnotatedElement.class)' 
is broken (bad constant pool tag 15 at byte 2713)

When I hit enter and type println("hello, world"), it again throws this

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 1501)

I am using Ubuntu 14.04 and java -version gives

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Either update to a newer scala version (2.10.3+) or downgrade java to java 6/7. As you have seen in the output, 2.9.2 was here long before java 8 was introduced (Copyright 2002-2011, LAMP/EPFL), so they don't work well together.

This duplicate question contains exact instructions on ubuntu's java downgrade.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...