Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I programmatically set a source folder in Eclipse?

Tags:

java

eclipse

I need to create small files to save basic information. I can't read and write from the files once my project is exported as a JAR, so I created a folder to store the files outside of the src folder. This only works if I set the external folder to be a source folder.

This is the code where I create the folder

File f = new File("Characters");

try{
    if(f.mkdir()) { 
        System.out.println("Directory created");
    } else {
        System.out.println("Directory not created");
    }
} catch(Exception e){
    e.printStackTrace();
} 

How can I programmatically set this folder to be a source folder?

I hope this is specific enough.

like image 870
molasses Avatar asked Aug 05 '26 10:08

molasses


1 Answers

These sound more like resource files rather then source files which require compiling.

Why not put them in a resource directory and load them when needed?

like image 73
ShayM Avatar answered Aug 06 '26 23:08

ShayM