I want to modify a connection string that's hard-coded in a Java application (jar without source).
I presume it's possible to decompile the jar, then change the source and recompile to a new jar, but is there a quicker way to do this?
EDIT:
In your application that uses that jar, you could use reflection to set the connection String. (Reflection can be used even with private setters).
Obviously, if the setter is public, you could just call it without reflection.
I think decompilation is probably the quickest way, provided the code hasn't been obfuscated such that a decompilation/compilation round-trip is not possible. You're going to have to decompile the code anyway to find the connection string, so you're half-way there already.
More importantly, you can take advantage of this method to pull the connection string out into a properties file, and hence (hopefully) only perform the decompilation once!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With