I am attempting to download a file from Google Cloud Storage. I'm using Google's Github code here on line 1042. I believe my error is with the file path. The path variable is to state where the file is downloaded to and the new name of it, correct? Note, I'm using a JSP button to start the process. To make it easier to solve for myself I replaced the String and Path variables with Strings instead of the HttpServletRequest.
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// [START storage_download_file]
// The name of the bucket to access
String bucketName = "media";
// The name of the remote file to download
String srcFilename = "File.rtf";
// The path to which the file should be downloaded
Path destFilePath = Paths.get("/Volumes/Macintosh HD/Users/ab/Desktop/File.rtf");
// Instantiate a Google Cloud Storage client
Storage storage = StorageOptions.getDefaultInstance().getService();
// Get specific file from specified bucket
Blob blob = storage.get(BlobId.of(bucketName, srcFilename));
// Download file to specified path
blob.downloadTo(destFilePath);
// [END storage_download_file]
}
Caused by: java.nio.file.NoSuchFileException: /Volumes/Macintosh HD/Users/ab/Desktop/File.rtf