Passing Cookies from Java to Browser <p>I've been trying to pass cookies from an HttpsURLConnection to my browser. Unfortunately, I haven't found... Well, anything at all on the topic besides Android, which is not what I want. The cookies are session-specific, so I have to download them from the webpage every time. Is there any way to open a webpage from Java in a browser (Firefox, Chrome, etc) and send cookies over?</p> <p>Code so far: (Yes, I know putting "throws Exception" on the main method is not smart in any way. Please just ignore it, it won't be there when this is working.)</p> <pre><code> public static void main(String[] args) throws Exception { String httpsURL = "https://www.link.com"; URL myurl = new URL(httpsURL); HttpsURLConnection con; CookieManager cManager = new CookieManager(); CookieHandler.setDefault(cManager); /* Start by connecting to website so CookieManager can grab cookies */ con = (HttpsURLConnection) myurl.openConnection(); /*COOKIES*/ CookieStore cookieJar = cManager.getCookieStore(); List&lt;HttpCookie&gt; cookies = cookieJar.getCookies(); System.out.println("COOKIES:"); String list = null; for (HttpCookie cookie : cookies) { if (list != null) { list += "; "; } list += cookie.getName()+"="+cookie.getValue(); System.out.println(cookie.getName() + " : " + cookie.getValue()); } con.disconnect(); // Here is where I want the cookies to transfer to the browser... } </code></pre>