Solved No such file or directory

Discussion in 'Spigot Plugin Help' started by MrGG4ming, Jan 9, 2020.

  1. Hello, I'm having a problem creating a file, for some reason it can't find the directory to create, but I don't understand exactly why. (Observation, i am using multicraft)

    Code (Text):
    if (!Main.plugin.getDataFolder().exists()) Main.plugin.getDataFolder().mkdir();
    File file = new File(Main.plugin.getDataFolder(), schem_name + ".schematic");
    file.createNewFile(); //here is the error

    The error:
    Code (Text):
    09.01 18:01:45 [Server] WARN java.io.IOException: No such file or directory
    09.01 18:01:45 [Server] WARN at java.io.UnixFileSystem.createFileExclusively(Native Method)
    09.01 18:01:45 [Server] WARN at java.io.File.createNewFile(File.java:1012)
    09.01 18:01:45 [Server] WARN at com.plotgen.Main$2.run(Main.java:100)
    09.01 18:01:45 [Server] WARN at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76)
    09.01 18:01:45 [Server] WARN at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52)
    09.01 18:01:45 [Server] WARN at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    09.01 18:01:45 [Server] WARN at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    09.01 18:01:45 [Server] WARN at java.lang.Thread.run(Thread.java:748)