I am using Netbeans IDE and currently I am using GlassFish server. What I want to do is write to a file .
I looked through several pages, and the code that I have (which doesn't work as far as I know) looks like this:
File outputFile = new File(getServletContext().getRealPath("/") + "TheFile.txt"); FileWriter fout = new FileWriter(outputFile); fout.write("The Content"); fout.close();
This is my project structure:

And where will the file be placed?
Edit: I forgot to mention that there are several other folders below those in the picture: test packages, libraries, test libraries, and configuration files. However, I do not think the file will be posted there.
Edit (newest): I found out that the file is stored in the / build / web folder, but this does not appear in Netbeans. Even after I restarted it.
source share