H5W3
当前位置:H5W3 > java > 正文

【Java】exe4j 打包 spring-boot 应用 报错

java.lang.NoClassDefFoundError: BOOT-INF/classes/com/example/DemoApplication (wrong name: com/example/DemoApplication)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:59)
at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:101)

这只是一个 demo

DemoApplication.java

package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

是 用 exe4j 打包的步骤出现问题了 还是 本身这个程序就不能 用 exe4j 打包吗

回答

spring boot jar包中MANIFEST.MF内容:
Manifest-Version: 1.0
Implementation-Title: com-iciyun-health-driver
Implementation-Version: 0.0.1-SNAPSHOT
Archiver-Version: Plexus Archiver
Built-By: thinkpad
Implementation-Vendor-Id: com.iciyun.health
Spring-Boot-Version: 1.5.6.RELEASE
Implementation-Vendor: Pivotal Software, Inc.
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.iciyun.health.DriverApplication
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_77
Implementation-URL: http://projects.spring.io/spr…

ealth-driver/

使用Main-Class: org.springframework.boot.loader.JarLauncher类启动。

请问一下解决了吗,我也遇到了同样的问题

本文地址:H5W3 » 【Java】exe4j 打包 spring-boot 应用 报错

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址