How to change one system property without code or from command line

I'm developing a mocking framework and I need to change the class loader that unit uses to something else (This is due to a property of the API I'm mocking). I found that you can do this reliably in Junit by creating a custom LauncherInterceptor. The problem is that a system property needs to be assigned for this LauncherInterceptor implementation to be found.

I'm therefore wondering if it's possible to set a system property from a library that will later be used during tests for other projects. The user should preferably not have to do anything. Yes, there is the System.setProperty function, but this requires a class to be loaded for this to work, which might not reliably be the case.
Was this page helpful?