M
M
mrsakura522021-12-10 22:09:38
Java
mrsakura52, 2021-12-10 22:09:38

How to fix the problem with creating a folder?

I create a config folder:

private void configLoad() {
        try {
            configFile = new File(getDataFolder(), "config.yml");
            if (!configFile.exists()) {
                configFile.createNewFile();
            }
            configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
        } catch (IOException ex){
            getLogger().info("Could not create config!");
        }
}

I call when the server is turned on, it falls into catch and is not created ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-12-10
@rPman

you can of course guess, long and pointless, but you can display information about the exception in catch, in 99% of cases there is useful information there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question