4

I'm trying to use Miles Sabin's HList of his Shapeless project. So I installed sbt from Macports (this is version 0.11).

Unfortunately, when launching sbt, I have the following error message:

java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
    at xsbt.boot.Boot$.runImpl(Boot.scala:24)
    at xsbt.boot.Boot$.main(Boot.scala:15)
    at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;

Search google seems to point that sbt-launch.jar would be in classpath. But even though I export CLASSPATH to "", I still have the issue.

I also directly downloaded the sbt-launch.jar from typesafe, and running with java -jar, with exactly the same problem.

Any idea? Other people having the same issue?

EDIT

I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar

I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).

Leo
  • 757
  • 5
  • 11
  • Not solving your general problem, but: There is a runner script in the shapeless repo. Have you tried to run it as `./sbt`? – Debilski Jan 20 '12 at 13:44
  • Nope, haven't seen that using SBT on the Mac before. Is it possible you have an old or nonstandard Java for some reason? What do "which java" and "java -version" report? – David Soergel Jan 20 '12 at 20:36
  • OSX5114:~ leo$ java -version java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode) – Leo Feb 20 '12 at 20:51
  • I've tried ./sbt first, but it raised the exact same issue. I've reported. I also directly have the problem when launching sbt-launch.jar. Very strange. I could finely use Shapeless, on a previous version, before it included its compiler plugin depending on sbt, so I could recompile within Eclipse. – Leo Feb 20 '12 at 20:55
  • I was getting `IncompatibleClassChangeError: Expected static method scala.Array$.unapplySeq` before I removed some jar-s from /Library/Java/Extensions/ (scala-library.jar among them). I myself placed it there. – idonnie Mar 08 '13 at 17:53
  • Your edited part solved my problem, so upvoting your question:) – engineer Sep 28 '13 at 07:00
  • I just got this with 1.7.0_72. I don't have anything in my Java Extensions directory, and "sbt" command works just fine. I'm trying to run my play framework (2.3.6) app from IntelliJ under sbt. – Reid Spencer Nov 01 '14 at 20:33
  • https://stackoverflow.com/questions/75947449/run-a-scala-code-jar-appear-nosuchmethoderrorscala-predef-refarrayops – Dmytro Mitin Apr 07 '23 at 04:54

2 Answers2

1

I have had this error, and generally uninstalling Java, and installing it again will resolve it.

Miguel
  • 1,966
  • 2
  • 18
  • 32
alex
  • 11
  • 1
0

OP posted:

I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar

I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319