Writing/modifying properties files at run-time sounds like trouble to me.
Particularly one that is part of a web application classpath.
There is a reason that you can only GET resources from the classLoader.
To answer your question on how you may be able to do it:
An alternative method to look at is the ServletContext method: getRealPath().
That converts a website relative path into a true location on disk.
Now you have the File handle, you can open it for writing.
- this may not actually resolve to a File on disk. It might be a file in a jar archive, which would not be editable.
- even if it is a file, and you write to it, there is no guarantee it will be read again except by restarting the web application.
What is the use case for this? Are these config properties intended to be edited often?