I have created a Java desktop application. One of its buttons checks updates by connecting to my website and checking some files.
One of the application users cannot check the updates, as he gets “Connection error”. He said that he connects to my website through a proxy server. I am not professional in Networking, so could this be the reason of the connection failure ?
Here is the code i use to connect from the program to the website :
URL url = new URL( "www.mywebsite.com" ) );
URLConnection conn = (URLConnection) url.openConnection();
conn.setConnectTimeout( 20000 );
conn.setDoOutput( true );
conn.setDoInput( true );
conn.connect();
The proxy is probably interfering. If possible, get the proxy details from the user, and pass them via the command line:
Alternatively, you can prompt the user in the program, and then set the required values through
System.setProperty:Edit: Here’s a complete guide: http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html.