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.NoCla ssDefFoundError : 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.Strin g;
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.prin tln("Digital File List from " + arg[0] + "\r\r\r");
d.ListImages(ar g[0]);
}
}
public void ListImages(Stri ng dirItem) {
File file;
String list[];
int i=0, j=0;
file = new File(dirItem);
if (file.isDirecto ry()) {
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.prin tln(",");
System.out.prin t("\t\t\"" + list[i].substring(0,
list[i].length()-4) + "\",\t\t\"\ "");
}
}
}
System.out.prin tln("\r\r" + j + " images");
}
}
<<<<