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 { public static void validateNotExists(File f) throws IOException { if (f.exists()) { throw new IOException(String.format("%s exists, please choose another file\n", f.toString())); } } }