Without pasting the entire code here, the line where the exception keeps happening is :

```
PrintWriter prtwrt = new PrintWriter(new File(directoryName+File.separator+stud.getIndex()+".txt"));

```

I have consulted the internet, and the books I have on Java, and by all logic it ought to work, but it doesn't. Can someone explain as to why it doesn't work, or perhaps propose a solution?

Stacktrace : 

```
java.io.FileNotFoundException: students\0096-03.txt (The system cannot find the path specified)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileWriter.<init>(Unknown Source)
    at StudentsManager.main(StudentsManager.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:267)

```

Also, directoryName, as the name implies, is the name of the directory where the file should be created. In this case it is "students".