title: How to write the correct relative path to the file
body: <p>I'm doing an exercise where it picks and displays three random cards from a file of card images stored in lib/cards/cards of the project. Card images are named from 1.png to 52.png.
  My java file is in src which has the same level with lib
  Here's the code I used.</p>
  <pre><code>Random rd = new Random();
  int[] card = new int[3];
  //randomize cards
  card[0] = rd.nextInt(52) + 1;
  card[1] = rd.nextInt(52) + 1;
  card[2] = rd.nextInt(52) + 1;
  ImageView image_0 = new ImageView(&quot;lib/cards/cards/&quot;+ Integer.toString(card[0]) + &quot;.png&quot;);
  ImageView image_1 = new ImageView(&quot;D:/Visual Studio/New/Test/lib/cards/cards/&quot;+ Integer.toString(card[1]) + &quot;.png&quot;);
  ImageView image_2 = new ImageView(&quot;D:/Visual Studio/New/Test/lib/cards/cards/&quot;+ Integer.toString(card[2]) + &quot;.png&quot;);
  </code></pre>
  <p>Absolute path works just fine for image_1 and image_2, and relative path doesn't work for image_0. I wonder if I can use relative path for this, and if I can how to write the correct relative path for this to work.</p>