I've found a working solution, but I don't know if it could be considered right.
I've coded an MBean and deployed it as a jmx service.
When this service starts it reads from a property files the desired proxy settings and issues all the System.getProperties().put(...) values needed to set up the use of a proxy.
Also it call the Authenticator.setDefault() to provide a way to send username and password to the proxy.
Hope this idea could help someone.
Feel free to contact me if you have any idea or suggestion.