Where to place an input .txt file for a jar of your netbeans application
<p>The problem I'm having is rather trivial. I made a simple application in netbeans Java. The application on it's start loads an input file named try.txt for uploading some data. I have placed this file in the project folder and the following code works fine for file read operation</p>

<pre><code>      FileInputStream fstream = new FileInputStream("try.txt");
</code></pre>

<p>When I debug the program the application works fine. But when I build a jar of my project and run the jar through the command prompt, I get the following error</p>

<p>java.io.FileNotFoundException: try.txt (The system cannot find the file specified)</p>

<p>The problem is resolved if I use the absolute path of try.txt like</p>

<p>C:\Desktop\try.txt</p>

<p>But this is not what I want since I'm supposed to distribute the jar to other users as well. I want to know that is there any default directory of my jar where I can put the file. Or Is there any way I can include the file to the jar so it is uploaded upon execution</p>

<p>Regards</p>
