#Java decompiled jar
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
In IntelliJ, when you decompile a class from a JAR file, it is opened in a read-only mode by default. This is to prevent accidental changes to the original JAR file.
To make changes to the decompiled class, you can copy the code to a new class within your project. This allows you to edit and make modifications to the code without affecting the original JAR file. You can then work with the copied class as you would with any other class in your project.
Alternatively, if you need to make quick changes or test something out without copying the code, you can use IntelliJ's scratch files feature. Scratch files allow you to write and run code without creating a formal project or file structure. You can create a new scratch file, paste the decompiled code into it, make your changes, and test them out.
Overall, while editing decompiled classes directly from a JAR file in IntelliJ is not recommended due to read-only restrictions, there are ways to work around this limitation by copying the code to a new class or using scratch files for quick edits and tests.
It's not easy to recompile decompiled code correctly. As such you can't just edit the decompiled code (it doesn't actually exist). For what purpose do you want to edit the code? There are various tools for different use cases
In my code base there are user defined jars that have configurations and many other dynamic or to be changed jars that need changing and in my project i reference them and I thought can I just go into the jar there and change it
Instead of copying the code doing a ctrl + a and pasting it to another class once extracted it's quite tedious especially when you are debugging changes and constantly reverting as your problem solving @drifting gorge
- Why is your configuration in a jar file? Why not load it from a file?
- Why can't you just compile the jars from source code again? Do you not have access to that?
- Is the configuration code or text files? If it's text files you can just rename the jar to a zip and edit the files. If it's code you'll want another solution