You need to create the folder /home/myuser/.myapp/data/replay before you create the file.
You could try something like
if (!myFile.exists()) {
System.out.println("myFile is: " + myFile.getAbsolutePath());
if (!myFile.getParentFile().exists()) {
myFile.getParentFile().mkdirs();
}
myFile.createNewFile();
myFileWriter.write("0"); // Configured to write to myFile
}
Check the reference: