I came up with the follwing code…my Document is not created.
I dont get any Error messages. Regarding the Java API i did everything in the right order. The directory is created in the right way…so i dont have to worry about that.
Anyone got an idea or an hint where to look at?
public static void main(String[] args) throws Exception{
String path = null;
String destination = "/myfolder/test/" + createRandomPath(path);
try {
boolean status;
status = new File(destination).mkdir();
} catch (Exception e) {
System.out.println("Fehler: " + e.getMessage());
}
File document = new File(destination + "temp.docx");
//Edit: Here is the solution..Thank you
document.createNewFile();
}
static String createRandomPath(String path){
UUID uuid = UUID.randomUUID();
path = uuid.toString().replace('-', 'A').substring(0,9);
System.out.println(path);
return path;
}
you need to call createNewFile() to, err, create a new file on disk if that’s what you’re asking.
so you need code of the form: