java.lang.NoClassDefFoundError: helpers/GameHelper

Coderanch | Aliya Khamzieva | 8 months ago
  1. 0

    How to run several classes at the same time in mac terminal

    Coderanch | 8 months ago | Aliya Khamzieva
    java.lang.NoClassDefFoundError: helpers/GameHelper
  2. 0

    [SI-8358] Scala-xml is being picked up from bootclasspath - Scala | 1 year ago
    java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
  3. 0

    Scala-xml module is on the bootclasspath of the compiler because it's needed by scaladoc. However, Scala compiler will pick up all jars from bootclasspath (unless {{-nobootclasspath}} is passed). That's the reason Scala 2.11 compiles code containing xml literals even if we do not put scala-xml on the classpath explicitly: {code} $ cat XMLHelloWorld.scala object XMLHelloWorld { def main(args: Array[String]): Unit = { val xml = <hello>world</hello> println(xml) } } $ ./build/pack/bin/scalac -d sandbox/ XMLHelloWorld.scala {code} For command line {{scalac}} that's the behavior we probably want to have. However, we get the same behavior in Maven. Consider project with the following pom.xml: {code} <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId>sample</groupId> <artifactId>scala-module-dependency-sample</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.11.0-RC1</version> </dependency> </dependencies> <build> <sourceDirectory>src/main/scala</sourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.1.6</version> </plugin> </plugins> </build> </project> {code} If you try to compile ({{mvn scala:compile}}) the same code as above with Maven Scala plugin, it will succeed. However, there's no dependency on xml declared so if you try to run your code you get: mvn scala:run -DmainClass=XMLHelloWorld [...] [INFO] --- scala-maven-plugin:3.1.6:run (default-cli) @ scala-module-dependency-sample --- Exception in thread "main" java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding at XMLHelloWorld.main(XMLHelloWorld.scala) Caused by: java.lang.ClassNotFoundException: scala.xml.NamespaceBinding at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( ... 1 more {code} Also, if you don't try to run from Maven but just compile and then publish you won't notice any problem and you end up with broken published library due to undeclared dependencies.

    Scala JIRA | 3 years ago | Grzegorz Kossakowski
    java.lang.NoClassDefFoundError: scala/xml/NamespaceBinding
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    RuntimeException: Unable to instantiate application

    GitHub | 2 years ago | TomHennen
    java.lang.ClassNotFoundException: de.danoeh.antennapod.PodcastApp
  6. 0

    NoClassDefFound when compiling Scala with Java sources

    Stack Overflow | 2 years ago
    java.lang.NoClassDefFoundError: scala/collection/Seq

  1. rp 5 times, last 3 days ago
  2. johnxfly 4 times, last 5 days ago
  3. jokester 1 times, last 6 days ago
  4. tomthomas 13 times, last 1 week ago
  5. andyglick 1 times, last 2 weeks ago
77 more registered users
18 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.ClassNotFoundException


  2. Java RT
    2. Method)
    4. java.lang.ClassLoader.loadClass(
    5. sun.misc.Launcher$AppClassLoader.loadClass(
    6. java.lang.ClassLoader.loadClass(
    6 frames
  3. chap05
    1. chap05.Game.main(
    1 frame