How to Download CSV to file using Java

My program is to take in a URL that has a CSV file. I’m trying to pass the this into a file for further querying, but it returns with a NoSuchElementException.

public static void main(String[] args) throws ParseException, IOException, URISyntaxException {
    // TODO Auto-generated method stub

    String web = "";
    URL content = new URL(web);

    File file = new File(content.getPath());

    try {
        Scanner inputStream = new Scanner(file);    //Input file
        String[] values = data.split(",");
   while (inputStream.hasNext()){

            data =;

            values = data.split(",");
} catch (FileNotFoundException e) {
        // TODO Auto-generated catch block