I was given a ready code sample for an assignemt but I can't get it to work. Love when this happens!
package kth.id2010.lab.lab04;
import edu.princeton.cs.introcs.In;
import java.net.URL;
public class Driver {
public static void main(String[] args) {
URL url = Driver.class.getResource("kap1.txt");
In input = new In(url);//this is where the nullPointer is pointing
while(!input.isEmpty()){
String line = input.readLine().trim();
String[] words = line.split(" ");
for (String word : words) {
System.out.println(word);
}
}
}
}
and here is the full exception that gets printed out.
Exception in thread "main" java.lang.NullPointerException
at edu.princeton.cs.introcs.In.(In.java:105)
at kth.id2010.lab.lab04.Driver.main(Driver.java:12)
I'm using maven