I have below class.
public class Gettype {
public static void main(String[] args) throws IOException, ParseException {
URL url = new URL("http://static.ddmcdn.com/gif/recipes/octo-arm-150513 200x200.jpg");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31");
connection.getInputStream();
}
It throws FileNotFoundException. But when I access the same URL (http://static.ddmcdn.com/gif/recipes/octo-arm-150513 200x200.jpg) through browser, it works. Please help me.
http://static.ddmcdn.com/gif/recipes/octo-arm-150513200x200.jpgAre you sure file is really exist ?