I have tried unsuccessfully for a few hours now to edit the java files in a jar I am using as a library. I have marked the resource as a content root and as a source root but I am still unable to edit the code in the jars. The project compiles and runs correctly but I need to make an adjustment to a resource file and cannot; I have tried every project structure I could think of. Is it just impossible? All help is appreciated.
It is not recommended to edit JAR files. From the prespect of build reproducibility, it is better to:
Another approach is to "overlay" the changes you want to make by creating a another JAR with the alternative version of the resources and placing it earlier in the application classpath.
But if neither of those works for you, you can use the
jar command to modify a JAR file:
jar -x ...to extract the files to a temporary directory tree
jar -c ....to create a new JAR.
Obviously, signing the new JAR with the original keys would be an issue if you are not the original signer, but I doubt that that is relevant to you.