03
Май
2020

Не получается запустить jar-файл. “no main manifest attribute” или "Could not find or load main class com.pkg.NewJFrame"

Содержание Manifest.mf:

Manifest-Version: 1.0
Created-By: Apache Maven 3.3.9
Built-By: Peps
Build-Jdk: 14
Main-Class: com.pkg.NewJFrame

Содержание pom:

<?xml version="1.0" encoding="UTF-8"?>

-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">

<modelVersion>4.0.0</modelVersion>

<groupId>com.mycompany</groupId>

<artifactId>mavenproject4</artifactId>

<version>1.0-SNAPSHOT</version>

<packaging>jar</packaging>


-<properties>

   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

     <maven.compiler.source>14</maven.compiler.source>

       <maven.compiler.target>14</maven.compiler.target>

         <manifest.file> manifest.mf </manifest.file>

</properties>

-

-<plugins>


   -<plugin>

      <!-- Build an executable JAR -->    

        <groupId>org.apache.maven.plugins</groupId>

           <artifactId>maven-jar-plugin</artifactId>

           <version>3.1.0</version>    

          -<configuration>    

            -<archive>    

              -<manifest>

                   <addClasspath>true</addClasspath>

                   <classpathPrefix>lib/</classpathPrefix>

                   <mainClass>com.pkg.NewJFrame</mainClass>

              </manifest>

            </archive>

          </configuration>

       </plugin>

    </plugins>

</build>

Источник: https://ru.stackoverflow.com/questions/1119714/%D0%9D%D0%B5-%D0%BF%D0%BE%D0%BB%D1%83%D1%87%D0%B0%D0%B5%D1%82%D1%81%D1%8F-%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D1%82%D0%B8%D1%82%D1%8C-jar-%D1%84%D0%B0%D0%B9%D0%BB-no-main-manifest-attribute-%D0%B8%D0%BB%D0%B8-could-not-fi

Тебе может это понравится...

Добавить комментарий