netbeans 中没有错误 ide 但 java.lang.ClassNotFoundException: org.netbeans.lib.awtextra.AbsoluteLayout 错误 java -jar jarfilename.jar

No error in netbeans ide but java.lang.ClassNotFoundException: org.netbeans.lib.awtextra.AbsoluteLayout ERROR when java -jar jarfilename.jar

maven 应用 运行 在 netbeans 上没有错误 ide 并且清理和构建 运行 也没有错误,我没有提到的依赖项是 :(mongodb,mongodb driver,mysql,itext) 我尝试了 launch4j ,.exe 文件没有打开。 这是 POM 文件:

<?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>billing-system</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <repositories>
      <repository>
          <id>unknown-jars-temp-repo</id>
          <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
          <url>file:${project.basedir}/lib</url>
      </repository>
      </repositories>
  <dependencies>
     <dependency>
  <groupId>org.netbeans.external</groupId>
  <artifactId>AbsoluteLayout</artifactId>
  <version>RELEASE120</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>
      <itext.version>7.1.13</itext.version>
  </properties>
<build>
  <plugins>
      <plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
      <execution>
          <id>copy-dependencies</id>
          <phase>prepare-package</phase>
          <goals>
              <goal>copy-dependencies</goal>
          </goals>
          <configuration>
              <outputDirectory>
                  ${project.build.directory}/libs
              </outputDirectory>
          </configuration>
      </execution>
  </executions>
</plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
       <version>3.2.0</version>
      <configuration>
        <archive>
          <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
        </archive>
     
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
            <mainClass>login</mainClass>
          </manifest>
        </archive>
      </configuration>
     
    </plugin>
  </plugins>
</build>
  
</project>

我尝试在 lib/ 中创建一个 awtextra 文件夹,并从 external/ 中复制 absolutelayout 文件夹,但它没有用。这是命令行错误:

OneDrive\Desktop\billing-system\target>java -jar billing-system-1.0-SNAPSHOT.jar
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
        at login.initComponents(login.java:41)
        at login.<init>(login.java:21)
 

问题已解决 1.installed 行家 2.added配置为javaJAVA_HOME 3.added 配置到 maven MAVEN_HOME 4.added 目标为 pom 文件的插件 5.added 使用 jar 文件的依赖构建 6.used 用于 exe 文件的 launch4j 我的 pom 文件:


 <build>
    <plugins>
        <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>
                    ${project.build.directory}/libs
                </outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
                <mainClass>login</mainClass>
            </manifest>
        </archive>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </configuration>
</plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
         <version>3.2.0</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
       
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>login</mainClass>
            </manifest>
          </archive>
        </configuration>
       
      </plugin>
      <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.4.0</version>
  <executions>
        <execution>
            <phase>install</phase>
            <goals>
                <goal>java</goal>
            </goals>
        </execution>
    </executions>
  <configuration>
    <mainClass>login</mainClass>
  </configuration>
</plugin>

    </plugins>
    
        <defaultGoal>install</defaultGoal>
        <!-- Source directory configuration -->
        <sourceDirectory>src</sourceDirectory>

  </build>