How extract source code from AEM bundle or Jar | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi @neo-silicon 

 

I just want to add a note indicating that decompiling a JAR file can have legal implications depending on several factors, including the software license, and how you intend to use the decompiled code. So just be aware of that. Other than that, a bundle is just a normal JAR (with extra metadata) that can be treated like others have already replied.

4 replies

October 22, 2024

You can use java decompiler and drop the bundle jar to see folders https://java-decompiler.github.io/ or JD-Eclipse is a plug-in for the Eclipse IDE which serves the same purpose.

Sady_Rifat
Community Advisor
Community Advisor
October 22, 2024

Hello @neo-silicon,
First, you can download the jar from AEM, for that

  • Get the bundle Id of the bundle from http://localhost:4502/system/console/bundles
  • Go to folder navigation "crx-quickstart/launchpad/felix/bundle<ID>", where ID is the bundle ID you got from the first step.
  • You will findbundle.jar file under Version*.* directory- That is the jar file location for the bundle ID

Then you can use any decompiler tool to see the Java codes. for that, you can find some tools - https://medium.com/@aashupel2023/the-best-java-decompilers-online-in-2023-517bf6f4971f 

After that, you can copy and paste the original code and write your custom code.
Need to understand before customizing the code, how the bundle was previously executed by AEM.
The best approach for a large customize or bug jar is to create a separate AEM project to maintain this in the future. For smaller you can keep you project codebase in separate package.

October 22, 2024

There are multiple ways of doing it.

One way is to use this site http://www.javadecompilers.com/ and upload the jar and you can see all the classes available in jar/bundle. But Decompiled code will not be having any comments or inputs given in comments by code developer.

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
October 22, 2024

Hi @neo-silicon 

 

I just want to add a note indicating that decompiling a JAR file can have legal implications depending on several factors, including the software license, and how you intend to use the decompiled code. So just be aware of that. Other than that, a bundle is just a normal JAR (with extra metadata) that can be treated like others have already replied.

Esteban Bustamante