package download;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
public class Main {
public static void main(String[] args) throws IOException {
Path target = Paths.get("/tmp/java-download/target");
URL website = new URL("https://dl.bintray.com/bnd/dist/3.2.0/biz/aQute/bnd/aQute.libg/3.2.0/:aQute.libg-3.2.0.jar");
if ("The redirect URL works fine".isEmpty())
website = new URL(
try (InputStream in = website.openStream()) {
Files.copy(in, target, StandardCopyOption.REPLACE_EXISTING);
}
}
}
{code}
Exception in thread "main" java.io.FileNotFoundException: https://dl.bintray.com/bnd/dist/3.2.0/biz/aQute/bnd/aQute.libg/3.2.0/:aQute.libg-3.2.0.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at java.net.URL.openStream(URL.java:1037)
at download.Main.main(Main.java:21)
--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.