argument, the folder containing the files. When I run this from c:\java
and include the long pathname as the argument, it wokrs fine. But if I
attach to the folder with the .jpgs and try to simply type
ListFiles "thefolder" > output.txt
I get the error
Exception in thread "main" java.lang.NoClassDefFoundError: ListFiles
System variables CLASSPATH is .;c:\java and PATH contains c:\java so I
don't know why I get this error. I thought I can run the program from
any folder.
Thanks,
Pete
FYI here is the code
/* usage: cd c:\java; java ListFiles "c:\Documents and Settings\..." >
output.txt */
import java.io.*;
import java.lang.String;
public class ListFiles {
public static void main(String arg[]) {
ListFiles d = new ListFiles();
if (arg.length > 0) {
System.out.println("Digital Photo List from " + arg[0] + "\r\r");
d.ListImages(arg[0]);
}
}
public void ListImages(String dirItem) {
File file;
String list[];
int i=0, j=0;
file = new File(dirItem);
if (file.isDirectory()) {
list = file.list();
for (i=0, j=0; i < list.length; i++) {
list[i] = list[i].toLowerCase();
if (!list[i].startsWith("tn_") && (list[i].endsWith
(".jpg") || list[i].endsWith(".gif"))) {
if (j++ != 0) System.out.println(",");
System.out.print("\t\t\"" + list[i].substring(0,
list[i].length()-4) + "\",\t\t\"\"");
}
}
}
System.out.println("\r\r" + j + " images");
}
}
<<<<