【发布时间】:2020-05-10 04:00:48
【问题描述】:
我有一个简单的 hello world java 应用程序,我手动下载了 org.json 并将其添加到我的类路径中,以便运行以下应用程序。如何制作自定义 JRE 来运行包含 jar 的应用程序?
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Go {
public static void main(String[] args) {
SpringApplication.run(MessagingStompWebsocketApplication.class, args);
System.out.println("running");
}
}
不知道如何通过jdeps返回未找到
jdeps --add-modules java.base,java.logging --generate-module-info work in/spring-jcl-5.2.3.RELEASE.jar
Missing dependence: work/spring.jcl/module-info.java not generated
Error: missing dependencies
spring.jcl
org.apache.commons.logging.LogAdapter$Log4jLog -> org.apache.logging.log4j.Level not found
org.apache.commons.logging.LogAdapter$Log4jLog -> org.apache.logging.log4j.LogManager not found
org.apache.commons.logging.LogAdapter$Log4jLog -> org.apache.logging.log4j.Marker not found
org.apache.commons.logging.LogAdapter$Log4jLog -> org.apache.logging.log4j.spi.ExtendedLogger not found
org.apache.commons.logging.LogAdapter$Log4jLog -> org.apache.logging.log4j.spi.LoggerContext not found
org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.Logger not found
org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.LoggerFactory not found
org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.spi.LocationAwareLogger not found
org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.Logger not found
org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.Marker not found
org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.spi.LocationAwareLogger not found
org.apache.commons.logging.LogAdapter$Slf4jLog -> org.slf4j.Logger not found
他们不适合春天
这些没有回答我的问题,因为它们都没有展示如何制作自定义 JRE。
creating module-info for automatic modules with jdeps in java 9
Is there a way to add maven dependencies while using the maven-jlink-plugin?
这会生成一个module-info.java 和module-info.class,并且一直在引用这个https://www.baeldung.com/jlink 以试图弄清楚如何获取我的自定义jre,但我被困在这里。
谢谢
【问题讨论】:
-
好的,明白了,如果你的最终目标是构建一个自定义的 JRE,由于使用了自动模块,问题仍然是重复的。如果只是无法生成模块信息,它仍然有效。
-
@Naman 是的,我正在尝试生成 module-info.java,因此我最终可以制作自定义 JRE,但我的主要问题是首先获取 module-info.java/module-info .class