I'm using a new work computer that has an old sdk, Java 1.3.1, on it and wanted to see if I could do some class homework on it. I have this file from our professor and it works on his machine in class, and I am getting compiler errors when I run it. I checked the Java help files onlines and it looks like Collections have been supported prior to 1.3.1 so I am not sure why I am getting these errors. Here is my code:
import java.io.*;
import java.util.*;
public class WriteFile
{
public static void main(String[] args)
{
if(args.length == 0) {
args = new String[] { ".." };
}
List<String> nextDir = new ArrayList<String>();
nextDir.add(args[0]);
try
{
while(nextDir.size() > 0)
{
File pathName = new File(nextDir.get(0));
String[] fileNames = pathName.list();
for(int i = 0; i < fileNames.length; i++)
{
File f = new File(pathName.getPath(), fileNames[i]);
if (f.isDirectory())
{
System.out.println(f.getCanonicalPath());
nextDir.add(f.getPath());
}
}
nextDir.remove(0);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
Errors: '(' or ']' on line 12 which to me doesn't look like an error. Then a lot of cannot resolve symbol for List, String, nextDir on line 12, etc.
I figured it's either something super obvious, or something wrong with my work configuration. Thanks.