public static void touch(File file) throws FileNotFoundException {

        if (!file.exists()) {
            OutputStream out = new FileOutputStream(file);
            try {
                out.close();
            } catch (IOException e) {
                // Ignore.
            }
        }

        file.setLastModified(System.currentTimeMillis());
    }
public static void touch ( File file ) throws FileNotFoundException { if ( ! file . exists ( ) ) { OutputStream out = new FileOutputStream ( file ) ; try { out . close ( ) ; } catch ( IOException e ) { } } file . setLastModified ( System . currentTimeMillis ( ) ) ; }
Implements the same behavior as the "touch" utility on Unix.
It creates a new file with size 0 byte or, if the file exists already, it
is opened and closed without modifying it, but updating the file date and
time.

@param file The file to "touch."

@throws FileNotFoundException
If the file is not found.