in my Java project i have some propertie files in a folder src/properties. When running the application in eclipse loading and saving the file with the following code is no problem: 

```
    // create and load default properties
    Properties defaultProps = new Properties();
    File file = new File("src/properties/defaultProperties");
    if (!file.exists()){
        // Create new properties file
            ...
        FileOutputStream out = new FileOutputStream("defaultProperties");
        defaultProps.store(out, "---No Comment---");
        out.close();
    } else {
        // Load existing properties file
        FileInputStream in = new FileInputStream(file);
        defaultProps.load(in);
        in.close();
    }

```

However when i creata a Runnable Jar file with eclipse the properties don't get loaded correctly. The same happens when saving the file. I read something about :

```
InputStream is = getClass().getResourceAsStream(path);

```

But in this case how can i check with an input stream if the file is existing? How is the right way to do this I/O such that it works in executable Jar files?