简体   繁体   English

Java-编辑manifest.mf以在JAR中具有.class和.java文件

[英]Java - edit manifest.mf to have .class and .java files in a JAR

I would like to have .class and .java files in a JAR. 我想在JAR文件中包含.class和.java文件。 Thus, I have "bin" and "src" pastes in that JAR. 因此,我在该JAR中粘贴了“ bin”和“ src”。 How should I edit the MANIFEST.MF? 我应该如何编辑MANIFEST.MF?

JAR
 |
  -- bin -- .class files
 |
  -- src -- .java files
 |
  -- META-INF -- MANIFEST.FM

Im doing this: 我正在这样做:

Manifest-Version: 1.0 
Class-Path: ./bin/ 
Main-Class: simul.Simulador

But with no success. 但没有成功。

The jar file structure should be something like this; jar文件的结构应如下所示; the root of the package structure for the class files must be at the top level in the jar. 类文件的包结构的根必须在jar的顶层。

JAR
 |
  -- simul
 |    |
 |     -- Simulador.class
 |    |
 |     -- (other class files in "simul" package ...)
 |
  -- META-INF
      |
       -- src -- .java files
      |
       -- MANIFEST.MF

Your manifest should look like this: 您的清单应如下所示:

Manifest-Version: 1.0
Main-Class: simul.Simulador

The Class-Path attribute should only be used to refer to other JARs (or exploded class directories) external to the current jar file. Class-Path属性只能用于引用当前jar文件外部的其他JAR(或分解的类目录)。 It's not a path inside the jar. 这不是罐子里的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM