I have a class with a private static final field that, unfortunately, I need to change it at run-time.
private static final
Using reflection I get this error: java.lan
java.lan
If your field is simply private you can do this:
MyClass myClass= new MyClass(); Field aField= myClass.getClass().getDeclaredField("someField"); aField.setAccessible(true); aField.set(myClass, "newValueForAString");
and throw/handle NoSuchFieldException