I haven't programmed in Java for awhile and forgot how to get this to work.
I have a program ListFiles developed in c:\java which lists every .JPG and
..GIF file in a folder. It works fine running from that folder. It takes 1
argument, the pathname, so a command could be "java ListFiles ."
But if I try to run it from another folder, using
"java c:\java\ListFil es ."
then I get an error
"Exception in thread 'main' java.lang.NoCla ssDefFoundError : c:\java
\ListFiles/class"
How can I run this from a folder other than the folder with the .java and
..class files ?
BTW, Here's my code -
===========
import java.io.*;
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 Photo List from " + arg[0]);
d.recurseInDirF rom(arg[0]);
}
}
public void recurseInDirFro m(String dirItem) {
File file;
String list[];
file = new File(dirItem);
if (file.isDirecto ry()) {
list = file.list();
for (int i = 0; i < list.length; i++) {
list[i] = list[i].toLowerCase();
if (!list[i].startsWith("tn _") && (list[i].endsWith(".jpg ") || list
[i].endsWith(".gif "))) {
System.out.prin tln("\"" + list[i] + "\",\t\t\t\ " \",");
}
}
}
}
}
===========