I have a problem with writing to properties file via .jar file. My 'output' works only in Eclipse, but don't know how to change it and make it works in executable .jar.
FileOutputStream output = new FileOutputStream("src/application/data.properties",true);
InputStream in = Login.class.getResourceAsStream("data.properties");
properties.load(in);
properties.setProperty(username+"Username", username);
properties.setProperty(username+"Password", password);
properties.store(output, formattedDate);
EDIT:
I'm getting no errors. I want to store this 'username' and 'password' in data.properties file which is included in a project. When I run it in Eclipse, it works. When I run it by .jar file, it doesn't write those data to properties file. I suppose, it's because when it creates 'output' while running jar, it is created only locally, and it doesn't provide me the access to appropriate file, but I might be wrong. I get this access and I can work on this existing file when I create 'in' by .getResourceAsStream(), but don't know how create 'output' in a similiar way, and be able to store data in already existing file in project. I create .jar in eclipse by "Export -> runnable JAR file " and run it by double-click.