日期:2014-05-17  浏览次数:20774 次

log4j开源代码研究---如何打包
最近项目需要对log4j扩展开发,需要研究源代码,改写源代码后,如何将源码打包成jar文件,我用的myeclipse,大家有没有好的方法?

------解决方案--------------------
jar命令试过了吗

jar cf jar-file input-file(s)

Let's look at the options and arguments used in this command:

The c option indicates that you want to create a JAR file.
The f option indicates that you want the output to go to a file rather than to stdout.
jar-file is the name that you want the resulting JAR file to have. You can use any filename for a JAR file. By convention, JAR filenames are given a .jar extension, though this is not required.
The input-file(s) argument is a space-delimited list of one or more files that you want to be placed in your JAR file. The input-file(s) argument can contain the wildcard * symbol. If any of the "input-files" are directories, the contents of those directories are added to the JAR archive recursively.

The c and f options can appear in either order, but there must not be any space between them.

http://java.sun.com/developer/Books/javaprogramming/JAR/basics/build.html


也可以试着拿对应版本的现存jar包将已修改的class文件进行替换
------解决方案--------------------
右键项目-->Export-->java-->JAR file
------解决方案--------------------
用反编译的软件全部反编辑之后,修改重新打包,不过整个包反编译的步骤容易出现错误。
或者把jar包用winrar打开,找到目录,把自己的工具类直接拖进去覆盖也可以的