How to change System.getProperty("user.dir") to project workspace
<p>I try to read a .txt file line by line in my code, which I placed it just right under the <code>/src/</code> directory, when I run it with test case or with static void main, the path output is correct.  However, when I run the application with Tomcat server, the app root path points to where I download my Eclipse - <code>D:\eclipse\...</code>, while the correct path should be <code>D:\workspace\myproject\src\</code>.  Then, of course, it can never find the file.</p>

<p>Below is my code: </p>

<pre><code>String workDir = System.getProperty("user.dir");
String file = "numFile.txt";
File myFile = new File(workDir + file);
String userPath = myFile.getPath();
</code></pre>

<p>So, my questions are:</p>

<ol>
<li>(this maybe dump) Where should we normally place a text file?</li>
<li>How can I change [<code>System.getProperty("user.dir");</code>], so it will point to my project workspace?</li>
</ol>

<p>Thank you!</p>

<p>Sharon</p>

<hr>

<p>regarding to your reply: </p>

<p>add following arguments -Duser.home='Your Path' make sure you add -D at the begining of your system variable. And this variable you can put in the VM Arguments box provided under arguments tab when you Open the Launch Configuration when using tomcat server.</p>

<p>I cannot find the place you are talking about.  Is it in Eclipse or Tomcat directory?</p>

<p>thanks</p>
