java.lang.NoClassDefFoundError: helpers/GameHelper

Coderanch | Aliya Khamzieva | 7 months ago
  1. 0

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

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

    [SI-8358] Scala-xml is being picked up from bootclasspath - Scala

    scala-lang.org | 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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <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 java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 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. andyglick 2 times, last 6 days ago
  2. richard77 1 times, last 1 week ago
  3. musketyr 2 times, last 1 week ago
  4. michallos 2 times, last 1 week ago
  5. batwalrus76 2 times, last 1 week ago
67 more registered users
28 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

    helpers.GameHelper

    at java.net.URLClassLoader$1.run()
  2. Java RT
    ClassLoader.loadClass
    1. java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    2. java.security.AccessController.doPrivileged(Native Method)
    3. java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    4. java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    5. sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    6. java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    6 frames
  3. chap05
    Game.main
    1. chap05.Game.main(Game.java:11)
    1 frame