Skip to content

Instantly share code, notes, and snippets.

@asavt92
Created May 29, 2020 17:01
Show Gist options
  • Save asavt92/6f0b66a8af90b918b8359a7aa5cccf79 to your computer and use it in GitHub Desktop.
Save asavt92/6f0b66a8af90b918b8359a7aa5cccf79 to your computer and use it in GitHub Desktop.
JAVA jar editing
(IntellijIdea)
we have EsServer.jar archive and we plan to change EsServer.class file and rebuild jar.
1. Unzip JAR
unzip EsServer.jar -d ./out/
# or `jar xf ./EsServer.jar` to unzip to current dir
2. Decompile in IntellijIdea or by https://www.mikeleitz.com/blog/2018/8/9/decompile-java-classes-on-command-line `EsServer.class`
3. Update File EsServer.java
4. Compile EsServer.java
javac -classpath EsServer.jar ./EsServer.java
5. recreate archive
cd ./out && zip -r ../TestServer.jar *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment