I made a few small changes to your program. I changed it first to a do-while loop, because it has to go through at least once. I also put your readline inside the loop. Then, your sort method was giving me some errors, so I used a sort method inside the collectinos class. Just changed three lines, basically. Here's your edited code.
import java.util.*;
import java.io.*;
public class Example2
{
public static void main() throws IOException
{
//set up input stream
BufferedReader filein = new BufferedReader(new FileReader("filein.txt"));
//set up output stream
PrintWriter fileout = new PrintWriter(new FileWriter("fileout.txt"));
//Declare variables
String nextLine; //a line read from file
StringTokenizer t; //the words within the line
ArrayList a = new ArrayList(); //store all words here
String s; //next word
boolean isAWord; //true if string represents a Word
char[] nVal = { '.',',','!',':',';','?' }; // not valid characters
int countGood=0, countBad=0;
System.out.println("Starting to read");
//start
do
{
nextLine = filein.readLine(); //read from input file
t = new StringTokenizer(nextLine); //identify words
nextLine = nextLine.toLowerCase( );//Converts to Lowercase()
while (t.hasMoreTokens())
{
a.add(t.nextToken()); //add next word to list
}
Collections.sort(a);
// This line wont work and brings up the error that it cannot resolve symbol
}while (nextLine != null); //finished reading file
fileout.println(a);
System.out.println("Finished");
fileout.close();
}
}