1
votes

I installed the Scala IDE for Eclipse and created a HelloWorld object in the package sample, all using the Eclipse Scala perspective. Now when I click run I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: scala.Predef$
    at conformal/sample.HelloWorld$.main(HelloWorld.scala:7)
    at conformal/sample.HelloWorld.main(HelloWorld.scala)
Caused by: java.lang.ClassNotFoundException: scala.Predef$
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:769)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1055)
    ... 2 more

which I can only assume means that the scala jar file is not available. Which seems super strange. Also according to the Package Explorer it seems to be listed. Must I still add it to the run configuration somehow?

This is what hte PAckage explorer looks like enter image description here

I have tried two version of Java:

  • adoptopenjdk12-openj9
  • adoptopenjdk13-openj9
1
What is the jdk and scala version that you are using?Anand Sai
Does deleting the module-info.java file fix your issue?howlger
@howlger No makes no differencejonalv

1 Answers

1
votes

I think there could be couple of reasons for this behavior:

  • jdk12 or jdk 13 is incompatible with scala library container 2.12.3. You need to have jdk version downgraded as mentioned in jdk compatability document
  • scala library jar is not added to the classpath. To add scala library to the classpath via Eclipse: Right-click on your project -> Build Path -> Configure Buildpath -> Libraries -> Add Library -> Select the Scala Library

Hope it Helps!!