It's not a secret anymore!*
The moose likes I/O and Streams and the fly likes Download a file from a https: website Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Download a file from a https: website" Watch "Download a file from a https: website" New topic

Download a file from a https: website

Quang Pham
Ranch Hand

Joined: Nov 29, 2005
Posts: 47
Can some one show me how to write a java program to download a file from a secure server https?
Currently I am able to download file from http but got certificate issue when trying to download from https.
Here is the code:
public static void main(String args[]) throws IOException { in =
new java
.URL("").openStream()); fos =new"c:/bankInfo.txt"); bout = new BufferedOutputStream(fos, 1024);
byte[] data = new byte[1024];
int x = 0;
while ((x =, 0, 1024)) >= 0) {
bout.write(data, 0, x);
System.out.println("File Downloaded");
I agree. Here's the link:
subject: Download a file from a https: website
Similar Threads
SCWCD 1.5 -- My Notes
Download link for GlassFish 3
Article about 'Job Changing' written by Chairman of Tata Sons Ltd
How to reproduce "DerInputStream.getLength(): lengthTag=127, too big"
Downloading File through a Servlet.