0

I'm trying to make a jar of a code that i made in maven. But when i try to execute the jar generated by: mvn clean package

I got the following error: rror: Unable to initialize main class <Main_Class> Caused by: java.lang.NoClassDefFoundError: us/hebi/matlab/mat/types/MatFile

I use the import us.hebi.matlab.mat.types.MatFile in my code and i put the dependency in the pom.xml as:

    <dependency>
        <groupId>us.hebi.matlab.mat</groupId>
        <artifactId>mfl-core</artifactId>
        <version>0.5.14</version>
    </dependency>

I can run the code with netbeans and visual studio in my Kali Linux with openjdk 17.0.6 2023-01-17 , but i can't run the jar.

Please someone could help me ?

Greetings.

I try to generate the jar in netbeans and visual studio, but also i try to put the following plugin in the pom.xml.

    <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <version>3.0.2</version>
      <configuration>
        <archive>
          <manifest>
            <mainClass>MAIN_CLASS</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
Panda
  • 1

1 Answers1

0

There are many existing answers for this, such as Why am I getting a NoClassDefFoundError in Java?. As noted there, you'll need to look more deeply at the stack trace and will likely find another error that will help explain things.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 09 '23 at 11:57