0

I'm trying to run a Java project from GitHub and having a weird exception.

Here is the portion of the code affected:

package de.fau.cs.osr.hddiff.perfsuite;

import de.fau.cs.osr.hddiff.utils.Report;

public class PerformanceSuite
{
    private Report report = new Report();
    ...
}

Then while executing the JAR file, I'm getting:

Exception in thread "main" java.lang.NoClassDefFoundError: de/fau/cs/osr/hddiff/utils/Report
at de.fau.cs.osr.hddiff.perfsuite.PerformanceSuite.<init>(PerformanceSuite.java:69)

Caused by: java.lang.ClassNotFoundException: de.fau.cs.osr.hddiff.utils.Report
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more

Any idea why this happens? Other classes are well imported and initiated.

Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265
  • maybe you need to add jar file to your project or change path to that library – Wassim Ben Hssen Dec 05 '19 at 11:58
  • What happens if you build the jar with `mvn clean package` and then try to run it again? – Titulum Dec 05 '19 at 11:59
  • Does this answer your question? [How do I resolve ClassNotFoundException?](https://stackoverflow.com/questions/17408769/how-do-i-resolve-classnotfoundexception) – rzwitserloot Dec 05 '19 at 11:59
  • How you are executing the jar ? Is reference for this library provided ? – Rmahajan Dec 05 '19 at 12:03
  • @Titulum, this is not helping. Trying to mvn clean and mvn install, same issue – Milos Cuculovic Dec 05 '19 at 12:08
  • @Ros5292, I'm calling it with java -jar xxx.jar – Milos Cuculovic Dec 05 '19 at 12:09
  • @Was'SiimBenHssen, I see, but this project is composed of two other sub-projects, maven should build them all. How to know which jar to look for? – Milos Cuculovic Dec 05 '19 at 12:12
  • Right-click on your Java project and Select Properties,Java Build Path and Select Third tab, Libraries and check if there is some libraries with red path or something – Wassim Ben Hssen Dec 05 '19 at 12:15
  • @rzwitserloot, not really, as I already went through and wasn't able to find the solution – Milos Cuculovic Dec 05 '19 at 12:15
  • @Miloš The linked-to question is the same question. If the answers aren't helpful, perhaps give more details about your question. Note that a file named /de/fau/cs/osr/hddiff/utils/Report.class needs to be in your jar. if it is not, there is your problem. – rzwitserloot Dec 05 '19 at 12:31
  • @rzwitserloot, thanks. The question is the same, but in different context. Instead of posting a comment there with probably no answer, I opted to post a new one, but description is missing, agree. By decompressing the jar file. I have found there is no de/fau/cs/osr/hddiff/util directrory in, only the de/fau/cs/osr/hddiff/perfsuite, now I need to find out how to add the missing one. – Milos Cuculovic Dec 05 '19 at 12:42

1 Answers1

0

Go to "Maven Projects" -> "Execute Maven Goal" and try "clean install -Dmaven.test.skip=true -U"

bryan
  • 83
  • 3
  • 9