public static void setFinalStaticField( Class classWhichContainsField, String fieldName, Object newValue) { try { Field field = classWhichContainsField.getDeclaredField(fieldName); setFinalStaticField(field, newValue); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } }