Authenticator.setDefault(new Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
 
        return new PasswordAuthentication("domain\\user","password".toCharArray());
    }
});

Reference: https://stackoverflow.com/questions/120797/how-do-i-set-the-proxy-to-be-used-by-the-jvm/12295125#12295125