I am running the following java program in the Eclipse IDE:
import java.net.*;
import java.io.*;
public class HH
{
public static void main(String[] arg
Create a keystore containing the fiddler certificate and use it:
java -DproxySet=true -DproxyHost=127.0.0.1 -DproxyPort=8888 -Dhttps.proxyPort=8888 -Dhttps.proxyHost=127.0.0.1 -Djavax.net.ssl.trustStore= -Djavax.net.ssl.trustStorePassword= -jar test.jar
If you use third party HTTP libraries, you need to set the connection proxies. Example with Apache Commons HttpClient:
HttpClient httpClient = new HttpClient();
httpClient.getHostConfiguration().setProxy("localhost", 8888);
UPDATE:
if you are using Apache HttpClient 4.5.5 or newer, you need to do it like this:
HttpHost proxy = new HttpHost("localhost", 8888, "http");
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
CloseableHttpClient httpclient = HttpClients.custom()
.setRoutePlanner(routePlanner)
.build();