You cannot. You cannot modify it possibly because the server has loaded it and is using it. You have to somehow make the server unload it and then you can replace it.

BTW, why do you want to replace it just like that ? I would suppose it will be an installation function to replace it, and if so, one of the things the installer should do is to shutdown the applications that it needs to install.