Q:

Java eclipse error with exported runnable jar file

I have a problem with an exported jar file.  When I run my project in Eclipse it runs fine, but when I run it as an exported jar from the console I receive the following error message: 
java.io.FileNotFoundException: firstLaunch.properties (System can't find file)
or
java.io.FileNotFoundException: resources/config/firstLaunch.properties (System can't find file)

I tried to put it in to the resource folder and change syntax from firstLaunch.properties to /resource/config/firstLaunch.properties, but again it says the same thing but with a different path. I don't know why is this doing this.
Here is the code:
public void saveConfigFile(String file, String key, String value) {
    Properties prop = new Properties();
    OutputStream output = null;

    try {

        output = new FileOutputStream(file);

        // set the properties value
        prop.setProperty(key, value);

        // save properties to project root folder
        prop.store(output, null);

    } catch (IOException io) {
        io.printStackTrace();
    } finally {
        if (output != null) {
            try {
                output.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}

My syntax for executing the method is
if (properties.loadConfigFile("firstLaunch.properties", "value").equals(properties.loadConfigFile("true.properties", "true"))) {
        properties.saveConfigFile("port.properties", "port", "8795");
        properties.saveConfigFile("ip.properties", "ip", temp[1]);
        properties.saveConfigFile("firstLaunch.properties", "value", "false");
        settings.port = properties.loadConfigFile("port.properties", "port");
        settings.myIp = properties.loadConfigFile("ip.properties", "ip");
    } else {
        settings.port = properties.loadConfigFile("port.properties", "port");
        settings.myIp = properties.loadConfigFile("ip.properties", "ip");
    }

A:

Your problem probably has to do with how you are referencing the file location. Add some detail/code examples as to how you are referencing the code, so then we can be sure to help. Having said that here is another way to reference a properties file:
Put it in the classpath like this:
private static Properties prop = new Properties();
private static String filename = "<name of file>.properties";
InputStream input = <ClassName>.class.getClassLoader().getResourceAsStream(filename);
try {

    if (input==null) {
        loggerOut.log(Level.SEVERE, "Sorry, unable to find " + filename);
    }
    prop.load(input);   
    loggerOut.info("XML In storage path: " prop.getProperty("<property in file>"));
    fileNameAndPath = prop.getProperty("fileNameAndPathIN").trim();
    logNameAndPath = logPath + logName;

} catch (IOException ex) {
    ex.printStackTrace();
} finally {
    if (input!=null) {
        try {
            input.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

