473,503 Members | 12,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NoClassDefFoundError with Path

My java program ListFiles lists all .jpg files in a folder. It accepts 1
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");
}

}
<<<<
Jul 17 '05 #1
0 1431

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
167059
by: Lem | last post by:
I get the error Exception in thread "main" java.lang.NoClassDefFoundError when I type java app2 in the command prompt. I've tried moving to the jre directory and typed java c:\app2\app2, but it...
1
9097
by: Andy Howells | last post by:
Can anybody help me on this? I am getting the below error but have not got a clue why. The file in my classpath eing used has the class that it says is not defined. Any ideas? I am running java...
2
45733
by: dave | last post by:
(Forgive all caps... they are there to differentiate btw question and code) THIS IS THE ERROR I KEEP GETTING. IT COMPILES BUT WHEN IT RUNS, THE FOLLOWING POPS UP: Exception in thread "main"...
1
47594
by: greg.knaddison | last post by:
Hi, I'm trying to use the httpclient within Jython (see http://jakarta.apache.org/commons/httpclient/ for more information on the httpclient). My Jython version is: Jython 2.1 on...
3
15064
by: Bernd Oninger | last post by:
When I run the successfully compiled java source shown at the end I got a runtime error: Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/Content Where is the missing class ?...
0
1711
by: shibubaby | last post by:
Hi All, I am trying to compile some embedded SQL using the SQLJ in DB2 environment. My setup is as follows. 1) Fedora Core 5 2)IBM DB2 V8.2 I installed both the client/admin tools in the DB2...
4
3122
pbmods
by: pbmods | last post by:
Heya. I just installed PHP-Java-Bridge on my system, but I'm having a hard time getting it to stop crashing Apache. When I activate the 'Java.so' module in php.ini, I get the following error in...
3
2199
by: NamelessNumberheadMan | last post by:
I'm using MyEclipse to make a quick one or two use jar utility file to connect to a database and run some updates. I can get everything to compile fine, and create the jar without an issue, but when...
1
6415
Nepomuk
by: Nepomuk | last post by:
Hi! I'm working on a project using tomcat and spring. Now I have written a Bean class, which reads an XML-File via Springs XmlBeanFactory, creates a Vector from the collected Information and then...
0
7212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5604
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.