Here you can find the source of createFileIfNotExist(Path path)
public static void createFileIfNotExist(Path path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.file.Path; import java.nio.file.StandardOpenOption; public class Main { public static void createFileIfNotExist(Path path) throws IOException { try (FileChannel f = FileChannel.open(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) { }/*from w w w .ja v a 2s. c o m*/ } }