开发者

Rename jar package name

开发者 https://www.devze.com 2023-04-11 00:45 出处:网络
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.

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.

  1. 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"].

  2. Change line: dist.jar=... to a new path. E.g. dist.jar=${dist.dir}/f2.jar

  3. press "Build Main Project" or "F11" to build a new Jar file with the new name.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号