Rename jar package name
I have a jar file but unfortunately I lost source code due to my disk crash. I just want to change its package name to some meaningful name.
Is there any way that I can change package name of jar file and of course I need to update this package name in 开发者_开发知识库class files.
I know about Java Decompiler but I just want to change its package name.
jarjar might be able to do this.
It's designed to build a single big jar containing an application and its supporting libraries. It supports moving the libraries into different packages to avoid naming conflicts (for example you could use two different versions of the same library with different package name prefixes).
It can probably be configured to do what you want.
The package name is included in the class file so there is no easy way.
Decompile it and then do the changes you need, and then recompile and repackage it.
If you use NetBeans IDE 6... for creating Jar package, you can simply change Jar file name to your alternative.
Open file: "nbproject/project.properties" in your project directory [You can open it by drag&droping it to a Notepad window - run Notepad in windows by "Start/All Programs/Accessories/Notepad"].
Change line:
dist.jar=...
to a new path. E.g.dist.jar=${dist.dir}/f2.jar
press "Build Main Project" or "F11" to build a new Jar file with the new name.
精彩评论