Change string in Java bytecode (jar)

I want to change the connection string hardcoded in a Java application (jar without source).

I assume that you can decompile the jar, then change the source and recompile the new jar, but is there a faster way to do this?

EDIT:

  • This is a standalone application, not a bank, which I download from my own code.
  • I doubt it would be confusing: a scientific niche application, written by AWOL.
  • A solution that entails changing the in-memory string while the application is running will also be sufficient, but not ideal
+3
source share
5 answers

, , , , , / . , , .

, , , , (), !

+4

, , , String. ( ).

, , .

+10

, , Jar. Jar , ( vim), , . , .

, .

, .

0

jar - ZIP , zip- (WinZip ..) ; ( , ​​ , ); jar.

, , , , .

0

, , , , , .jar :

public String getConnectionString() {...

then just extend the class, override the method to return a new line and use your class instead. Obviously, this only works if the superclass is not final, the method is not final, and it is public or protected (if you can use the same package name).

0
source

Source: https://habr.com/ru/post/1722310/


All Articles