运行 jar 失败,错误:无法找到或加载主类 com.mycompany.tsu.orchestration.WeeklyTSUOrchestrator

问题描述 投票:0回答:0

我用 scala build.sbt 构建我的程序集:TSUOrchestrationLogic-assembly.jar

在我的META-INF/MANIFEST.MF中,Main-Class header是对的:

Manifest-Version: 1.0
Implementation-Title: TSUOrchestrationLogic
Implementation-Version: 1.0
Specification-Title: TSUOrchestrationLogic
Specification-Version: 1.0
Main-Class: com.mycompany.tsu.orchestration.WeeklyTSUOrchestrator

当我运行它时:java -jar ./TSUOrchestrationLogic-assembly.jar

因错误而失败:

Could not find or load main class com.mycompany.tsu.orchestration.WeeklyTSUOrchestrator

但是如果我将它解压缩到一个文件夹中:jar xf TSUOrchestrationLogic-assembly.jar,直接用类运行它,它可以工作:

java com.mycompany.tsu.orchestration.WeeklyTSUOrchestrator

我的 jar 程序集的根本原因可能是什么,我该如何诊断根本原因?

java jar classpath
© www.soinside.com 2019 - 2024. All rights reserved.