jar-用子目录构建,但仅包括.class文件
在Java中,我有一个项目,其目录结构看起来像这样,
.
├── enderbyteprograms
│ ├── consolecolours.class
│ ├── consolecolours.java
│ ├── consolegames
│ │ ├── games
│ │ │ ├── Game.class
│ │ │ ├── Game.java
│ │ │ ├── guess_the_number.class
│ │ │ ├── guess_the_number.java
│ │ │ ├── testgame.class
│ │ │ └── testgame.java
│ │ ├── Main.class
│ │ ├── Main.java
│ │ ├── shared.class
│ │ └── shared.java
│ ├── enderlib.class
│ └── enderlib.java
└── META-INF
└── MANIFEST.mf
我正在尝试将其构建到一个只有.class文件的JAR。 JAR CVFM consolegames.jar Meta-inf/subest.mf enderByTeprograms/*。类
仅包括类的顶级,导致程序抱怨没有找到入口点。使用jar cvfm consolegames.jar meta-inf/subest.mf enderbyTeprograms/*
包括子目录,但还包括所有各种源文件,都会导致不必要的复杂性。如何构建仅包含 *.class文件但还包括目录层次结构的JAR文件? [JAR 11.0.15]
编辑1: 清单文件是
Manifest-Version: 1.0
Created-By: Enderbyte Programs
Main-Class: enderbyteprograms.consolegames.Main
In java I have a project whose directory structure looks like this
.
├── enderbyteprograms
│ ├── consolecolours.class
│ ├── consolecolours.java
│ ├── consolegames
│ │ ├── games
│ │ │ ├── Game.class
│ │ │ ├── Game.java
│ │ │ ├── guess_the_number.class
│ │ │ ├── guess_the_number.java
│ │ │ ├── testgame.class
│ │ │ └── testgame.java
│ │ ├── Main.class
│ │ ├── Main.java
│ │ ├── shared.class
│ │ └── shared.java
│ ├── enderlib.class
│ └── enderlib.java
└── META-INF
└── MANIFEST.mf
I am trying to build this in to a jar that only has the .class files.jar cvfm consolegames.jar META-INF/MANIFEST.mf enderbyteprograms/*.class
only includes the top level of classes, causing the program to complain about not finding the entry point. Building with jar cvfm consolegames.jar META-INF/MANIFEST.mf enderbyteprograms/*
includes the subdirectories but also includes all of the assorted source files leading to unnecessary complexity. How to build a jar file that only includes *.class files but also includes the directory hierarchy? [jar 11.0.15]
EDIT 1:
The manifest file is
Manifest-Version: 1.0
Created-By: Enderbyte Programs
Main-Class: enderbyteprograms.consolegames.Main
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您的anist.mf是否具有属性主类,如果不添加此属性如下 -
主级:com.xyz.mainclass
Check if your MANIFEST.mf has attribute Main-Class, if not add this attribute as below -
Main-Class: com.xyz.MainClass