Linux 环境下,启动jar 包,提示main class not found



经过确认 是 MANIFEST.MF 文件有问题

Class-Path的格式要严格执行一下规则!

1)在 Class-Path: 后面有一个空格,切记 
2)在 Class-Path: 后面写上你的jar 用空格分开 

3)如果需要换行,切记在上一行末尾一定要有一个空格,下一行的开头一定要有一个空格 


附上pom插件配置

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.test.Main</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Class-Path>conf/</Class-Path>
                            <Specification-Version>${project.version}</Specification-Version>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Specification-Title>${project.artifactId}</Specification-Title>
                        </manifestEntries>
                    </archive>
                    <excludes>
                        <exclude>**/application.properties</exclude>
                        <exclude>**/logback.xml</exclude>
                    </excludes>
                    <jarName>app</jarName>
                </configuration>
            </plugin>

MANIFEST.MF文件内容

Main-Class: com.meizu.store.ordercenter.HkApplication
Class-Path: ./



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值