Scala 2.12.1 ClassNotFoundException Product $ class

I recently upgraded scala from v2.11.8 to version 2.12.1 and got a CNF exception:

java.lang.ClassNotFoundException: scala.Product$class 

I saw the class dispatched by scala -library.jar. The error occurs when starting scalatest (the project is still at a very early stage, so I only have tests).

Do you have any ideas? I did not find anything in the release notes.

+7
scala
source share
2 answers

In particular, feature implementations are no longer provided in classes called the suffix $class . In the release notes, you will find a notice about the "character encoding."

Perhaps you want to use sbt or ammonite if you experiment with any dependencies other than the built-in ones. One day they will have a neat β€œplatform” that will help you.

 $ cat notraitclass.scala package notraitclass trait T { def t: Int = 42 } $ scalac211 notraitclass.scala $ ls notraitclass T.class T$class.class $ rm -rf notraitclass $ scalac notraitclass.scala $ ls notraitclass T.class 
+1
source share
Libraries

not compatible with binaries between 2.11 and 2.12, most likely one of your libraries should be recompiled with scala 2.12

+7
source share

All Articles