0

i'm stuck at running my project from terminal, on netbeans, my code work perfectly fine, but when trying to run my jar from the terminal after building it I get the following error

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Sheet

that's how my pom.xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>DashboardOffice365</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
      <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.mycompany.dashboardoffice365.main</mainClass>
                    </manifest>
                </archive>
            </configuration>
          </plugin>
        </plugins>
        </build>
           
     <dependencies>
        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.1.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.2</version>
</dependency>
       
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

PS : I'm using Windows

Rached Khalledi
  • 187
  • 1
  • 1
  • 8
  • 1
    Already answered https://stackoverflow.com/a/42130888/2400380. Maven Jar Plugin does not include the dependencies in the output JAR. – Amir M Dec 21 '20 at 09:54
  • 1
    Does this answer your question? [Maven executable Jar throws error on start](https://stackoverflow.com/questions/42129639/maven-executable-jar-throws-error-on-start) – Amir M Dec 21 '20 at 09:55

0 Answers0