title: Text file not found
body: <p>So I can't seem to get my program to read a file "testOne.txt" and it keeps throwing the file not found exception. I am using eclipse and am keeping the testOne.txt file in the src folder in the project. I am hoping another set of eyes might be able to spot why my program cannot find the text file.</p>
  
  <p>*Edit- I was able to get that initial question resolved but I am having another problem not related to the original question. Now I am getting a NullPointerException on line 8 in my Main class (which I just posted below my BubbleSort class). Is it because I incorrectly declared the array or something?</p>
  
  <pre><code>package cse.unl;
  import java.util.*;
  import java.io.File;
  import java.io.FileNotFoundException;
  
  public class BubbleSort {
  
  int[] array;
  
  public BubbleSort(String filename) {
      Scanner scanner;
  
      try {
          scanner = new Scanner(new File("testOne.txt"));
      } catch (FileNotFoundException ex) {
          System.out.println("File Not Found");
          return;
      }
  
      while(scanner.hasNext()){
          String[] numbers = scanner.next().split(",");
           int array[] = new int[numbers.length];
           for (int i=0; i&lt;numbers.length; i++){
               array[i] = Integer.parseInt(numbers[i]);
           }  
      }
  }
  
  
  public void print() {
      for(int m=0; m&lt;array.length;m++){
          System.out.println(array[m]);
      }
  }
  
  public void sort() {
      for(int j=0; j&lt;array.length;j++){
          if(array[j]&gt;array[j-1]){
              int temp = array[j];
              array[j] = array[j-1];
              array[j-1] = temp;
          }
      }       
  }
  
  
  }
  </code></pre>
  
  <p>*Edit- Main class</p>
  
  <pre><code>package cse.unl;
  
  
  public class Main {
  
  public static void main(String args[]){
      BubbleSort myBubSort = new BubbleSort("tesOne.txt"); 
      myBubSort.sort();
      myBubSort.print();
  }
  
  }
  </code></pre>