Download a Webpage Java Program

Java Program To Download A Webpage using Command Line

Learn How To Write a Java Program To Download A Webpage using Command Line Arguments on the Console Screen. This Code To Download a Website Page in Java makes use of Advanced Java Programming concepts. The package plays a very important role in the code.

This Java Code To Fetch the Webpage saves the webpage in an HTML format in a text file. It, therefore, helps you to Save a Webpage for Offline Reading.

How To Enter Command Line Arguments

java class_name complete_url file_name

java DownloadWebpage CodingAlpha

The First Argument needs to be have the complete URL of the Webpage to be downloaded. It has to even the HTTP or HTTPS. The Second URL is used for saving the webpage in the system. Therefore, you can give it a name along with its extension such as .HTML, .HTM, .TXT and many others. The default extension is .HTML.

Also Read: Java Program To Take User Input using Scanner Class

Code To Download Website in Advanced Java Programming

Also Read: How To Connect C and Java for Java Network Interface


Advanced Java Tutorial To Download a Webpage in Java using Command Line Arguments

If you have any Compilation Error or Doubt about this Java Program To Download A Webpage, let us know about it in the Comment Section below.

Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

2 thoughts on “Download a Webpage Java Program

  • June 8, 2016 at 11:13 am

    Such an amazing program! Thanks! Now, I can download and save webpages for offline reading! 😀

    • June 8, 2016 at 11:45 am

      You’re welcome! I hope this program works on all the websites!


Join The Discussion