title: Using a Dynamic path for a csv file
body: <p>I have a program that saves on a file. The current code is set for the file to save on a specific path, but when I run the program from a different computer the program doesn't work and I need to change the path everytime. </p>
  
  <pre><code> public CreateCustomer() {
      initComponents();
  
      ArrayList&lt;String&gt; ConsIDList = new ArrayList&lt;String&gt;();
  
      String csvFileToRead = "E:\\ryan_assignment_sit2\\ConsID\\consID.csv"; // Reads the CSV File. 
      BufferedReader br = null; // Creates a buffer reader.
      String line = "";
      String splitBy = ","; // Reader Delimiter
  
      try {
          br = new BufferedReader(new FileReader(csvFileToRead)); // Buffer Reader with file name to read.
          Scanner reader = new Scanner(System.in);
          while ((line = br.readLine()) != null) { //While there is a line to read.
              reader = new Scanner(line);
              reader.useDelimiter(splitBy);
  
              while (reader.hasNext()) { // While there is a next value (token).
                  ConsIDList.add(reader.next());
              }
          }
  
      } catch (FileNotFoundException exception) { // Exception Handler if the File is not Found.
          exception.printStackTrace();
      } catch (IOException exception) { // Input/Output exception
          exception.printStackTrace();
      } finally {
          if (br != null) {
              try {
                  br.close(); // Close the Scanner.
              } catch (IOException exception) {
                  exception.printStackTrace();
              }
          }
  </code></pre>
  
  <p>I placed the file in the a subfolder in the program with the name ConsID and I tried changing the path file to </p>
  
  <pre><code>String csvFileToRead = "..\\ConsID\\consID.csv"; 
  </code></pre>
  
  <p>But the file can't be read from the program.</p>