There is some info tucked away in the Charles documentation, have a look at http://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration/
JAVA APPLICATION PROXY CONFIGURATION
You can configure your Java application to use Charles in code or as
command line arguments to the java executable.
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "8888");
And for HTTPS as well. Note that you may also want to configure Java
to trust Charles’s root certificate in this case (see SSL Proxying).
System.setProperty("https.proxyHost", "127.0.0.1");
System.setProperty("https.proxyPort", "8888");
For the source of this information, including more discussion and how
to set these as command line arguments:
http://java.sun.com/j2se/1.5.0/docs/guide/net/proxies.html
Also see this tutorial on integrating Charles with your Java
application by a Charles user.