public static void touch(final File folder , final String fileName) throws IOException {
        if(!folder.exists()){
            folder.mkdirs();
        }

        final File touchedFile = new File(folder, fileName);

        // The JVM will only 'touch' the file if you instantiate a
        // FileOutputStream instance for the file in question.
        // You don't actually write any data to the file through
        // the FileOutputStream.  Just instantiate it and close it.

        try (
            FileOutputStream doneFOS = new FileOutputStream(touchedFile);
        ) {
            // Touching the file
        }
        catch (FileNotFoundException e) {
            throw new FileNotFoundException("Failed to the find file." + e);
        }
    }
public static void touch ( final File folder , final String fileName ) throws IOException { if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } final File touchedFile = new File ( folder , fileName ) ; try ( FileOutputStream doneFOS = new FileOutputStream ( touchedFile ) ; ) { } catch ( FileNotFoundException e ) { throw new FileNotFoundException ( "Failed to the find file." + e ) ; } }
Creates a file

@param folder File
@param fileName String
@throws IOException