Editing

Hub page for editing capabilities

Relevant content

The basic steps

  1. Load a file to edit, plus any supporting content
  2. Navigate to the class you want to edit
  3. Make your changes and save them (Control + S)
  4. Export the modified file

Basic step 1: Loading

To load a file you want to edit, load it from the “File” menu and select “Load”, or drop it into the Recaf window area that shows the prompt “Drop application to begin”.

You can add supporting libraries from the “File” menu with “Add library”.

For more information see:

Basic step 2: Find the class you want to edit

To find the class in the workspace, you can open the package folders in the tree display until you find the class. Alternatively, you can type the class’s name in the search field to quickly find it.

For more information see:

Basic step 3: Make your changes

There are two main ways to make changes. Editing the decompiled code as source code, and making bytecode level changes.

Editing decompiled code

If your input file is not obfuscated and you have configured compiler support, then making your changes to the decompiled code and would be the quickest and easiest approach. This approach will require that you have either all the referenced classes loaded in the workspace or enabled phantom class generation with “Generate missing classes” in the config window. It is worth noting though that this is subject to the accuracy of the decompiled code and may not work in all cases. You can try the different decompilers and see which is the best fit for your situation.

For more information see:

Editing bytecode

If your input file is obfuscated (which typically breaks compiler support due to decompile errors) or you cannot use the compiler feature, then you will want to make changes at the bytecode level. Right click on the member you want to edit (For decompile mode, select its name) and choose “Open with assembler”.

The assembler allows you to edit bytecode as text. If your input contains line number debug information you can easily find what bytecode relates to each line of code by looking at the LINE statements. The code after each statement is on that line.

If your change is a simple one-liner you can write it as pure source code with the EXPR statement. For example, EXPR System.out.println(argString); or EXPR if (argBool) return true;

If your change is more complicated then you can write it as standard bytecode.

For more information see:

Basic step 4: Export the modified file

In the “File” menu select “Export program” and select a file location to save to.

For more information see: