Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.io.File; import java.io.IOException; public class Main { /** * @throws IOException if {@code f} does not exists. */ public static void validateExists(File f) throws IOException { if (!f.exists()) { throw new IOException( String.format("Error: %s doesn't exist, please choose another file\n", f.toString())); } } }