My CLASSPATH variable is set to ". ; c:\java" and Path contains c:\java
I have an application ListFiles.class in c:\java that runs correctly
from that folder. It takes as an argument the folder to list files in.
Yet when from another folder I type "ListFiles .", expecting to get an
output of that folder, instead I get the error
Exception in thread "main" java.lang.NoClassDefFoundError: ListFiles<
I don't know why apparently the Class is not found, despite being
defined in my system variables.
Thanks,
Pete
FYI, here's ListFiles.java - it lists digital image files in a folder
import java.io.*;
import java.lang.String;
public class ListFiles {
public static void main(String arg[]) {
/*
** java ListFiles . to list images from the current directory
*/
ListFiles d = new ListFiles();
if (arg.length > 0) {
System.out.println("Digital File List from " + arg[0] + "\r\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");
}
}
<<<<