简体   繁体   中英

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. Thus, I have "bin" and "src" pastes in that JAR. How should I edit the 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; the root of the package structure for the class files must be at the top level in the 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. It's not a path inside the jar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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