JAVA- Download a file from URL



Download the Source Code here

——————————————————————————————————-

Other videos related to this project.

Install Eclipse for JAVA Developers

Download and Install Netbeans on windows

How to install Mysql 5.0 in Windows

Best Mysql Client for Windows

How to add jar file in eclipse java project

How to deploy Java web project to a real website

Library Management System project in Java and Mysql Source Code

Test HTTP Request and Read the Response online

JAVA- Send HTTP Get/Post Request and Read JSON response

JAVA-Send URL HTTP Request and Read JSON Response

JAVA-Send URL HTTP Request and Read XML Response

Nguồn: https://svdpch.org/

Xem thêm bài viết khác: https://svdpch.org/cong-nghe/

8 thoughts on “JAVA- Download a file from URL”

  1. I am always getting below error message upon running code.
    java.net.ConnectException: Connection refused: connect

    at java.net.DualStackPlainSocketImpl.connect0(Native Method)

    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:589)

    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)

    at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)

    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)

    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)

    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)

    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:200)

    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1157)

    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)

    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)

    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)

    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)

    at HttpDownloadUtility.downloadFile(HttpDownloadUtility.java:38)

    at HttpDownloadUtility.main(HttpDownloadUtility.java:23)

    Reply

Leave a Comment