I exported my java project and ran it. At first it didnt work when I double clicked but upon some research I came across this solution
What I did was to create a batch file, jax.bat, saying: @java -jar %1 and I put this in my java/bin folder. I then associate .jar-files with jax.bat.
After that the problem seemed to be solved. However, when I tried to run it on my friends computer I found that when running from the command prompt it would write to the file as expected, but when it was run by double clicking it did not. Here's the code for the filewriter
File writeTo = new File("Destinations.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(writeTo),32768);
//Some lines later
bw.write("The price is $"+ prices.get(lowest)+" travelling to "+ places.get(i)+" on "+ month+"/"+day);
bw.newLine();
}
bw.close();
Edit: I tried adding the String workingDir... and running it on his computer. The message appeared, but said the file was in Windows/System32
Edit2: I built my jar file simply by exporting a runnable jar from eclipse.