Rename ATM Package Name

I have a jar file, but unfortunately I lost the source code due to my disk failure. I just want to change the name of my package to some meaningful name.

Is there a way to change the package name of the jar file and of course I need to update that package name in the class files.

I know about Java Decompiler, but I just want to change its package name.

+4
source share
3 answers

jarjar can do this.

It is designed to create one large jar containing the application and its supporting libraries. It supports moving libraries to different packages to avoid name conflicts (for example, you could use two different versions of the same library with different package name prefixes).

Perhaps he is tuned to what you need.

+8
source

The package name is included in the class file, so there is no easy way.

Decompile it, and then make the necessary changes, and then recompile and repack it.

+2
source

If you are using NetBeans IDE 6 ... to create a Jar package, you can simply change the Jar file name to your alternative.

  • Open the file: "nbproject / project.properties" in the project directory. [You can open it by dragging it into the Notepad window - launch Notepad in the Start / All Programs / Accessories / Notepad windows,].

  • Change the line: dist.jar=... to the new path. For instance. dist.jar=${dist.dir}/f2.jar

  • press "Build Main Project" or "F11" to create a new Jar file with a new name.

+1
source

All Articles