如果这个文件不存在应该会有FileNotFoundException或IOException,然后你根据是否有异常来解决是否创建文件输出流
FileOutputStream fos = new FileOutputStream("com/abc/def/log.properties");
FileOutputStream fos = new FileOutputStream("com/abc/def/log.properties");
这样会有IOException,没有这样的路径。