prøv lige at hent den med den her (ret URL) og check content type:
import java.net.*;
import java.io.*;
public class ArnesWebDownloadDebugger {
public static void download(String fileurl, String filename) {
try {
URL url = new URL(fileurl);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.connect();
int status = con.getResponseCode();
if (status == HttpURLConnection.HTTP_OK) {
InputStream is = con.getInputStream();
System.out.println("Content-Type header = " + con.getContentType());
System.out.println("Content Length Header = " + con.getContentLength());
OutputStream os = new FileOutputStream(filename);
byte[] b = new byte[1000];
int total = 0;
int n;
while ((n = is.read(b)) >= 0) {
os.write(b, 0, n);
total += n;
}
os.close();
is.close();
System.out.println("Actual length = " + total);
} else {
System.out.println("HTTP status = " + status);
}
con.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
download("
http://www.vajhoej.dk/arne/eksperten/showversion/showversion.class", "C:\\slet.class");
}
}