Each class has two classfiles in jar file

前端 未结 2 1671
青春惊慌失措
青春惊慌失措 2021-01-22 20:46

I have a jar file which has two class files per java file.

Java:

Foo.java
Bar.java

Classfile:

Foo.class
Foo.class
Bar.c         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-01-22 21:13

    Are you using the Ant Jar task? If so then you can most definitely get duplicate files in the same jar file. The duplicate attribute is used to stop that.

    Please note that the zip format allows multiple files of the same fully-qualified name to exist within a single archive. This has been documented as causing various problems for unsuspecting users. If you wish to avoid this behavior you must set the duplicate attribute to a value other than its default, "add".

    From the Ant Manual Page: http://ant.apache.org/manual/Tasks/jar.html

提交回复
热议问题