473,546 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem running from a different folder

I am having a problem running my Java application from a remote folder.

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");
}

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

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

Similar topics

4
3748
by: Stephan & Saori | last post by:
I found a "weird" problem running windows 2003 Server. Maybe it's a know problem but I just wanted to make sure everyone knows. When running explorer to find the directories on my hard disk. It's very, very fast with the exception of 1 folder. I know it's an accident but it happens to be the JDK folder. I could reproduce this stupid behavior...
21
4381
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very serious problem, and I was hoping someone might have thoughts.
4
7981
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the folder when i tried to delete the same folder in Explorer i am getting error saying that cannot delete that folder as some process is using it. After that i selected a file from the same folder in...
1
1700
by: Frankieboy | last post by:
I believe I've got a postback problem on our site. The strange thing is that everything works fine on my developing version, but not on the production site. I'm wondering if there may be different ..net-frameworks running. What I can read from the _doPostBack the developer edition is testing for Microsoft in the _doPostBack-routine, while...
1
1043
by: Peter | last post by:
Hi, I'm getting the following error when I run/debug my application: Could not load type 'MyApplication.SomeNamespace.SomeClassInNamespace' To give you more background information I have an application, with the following folder structure:
8
3370
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set it up as C:\domains\appA. Locally, my IIS root points to C:\domains. I don't point it to C:\domains\appA since if I have an appB under C:\domains I...
13
3915
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that .NET creates i get the following error message: "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in VisioTimeline.exe
5
4066
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names...
4
2752
by: mark4asp | last post by:
I want to write a xslt template to create a xhtml 1.0 (transitional) file which will be sent in as email. Here is a typical xml data file: <BatchEmail> <Domain>www.myDomain.com</Domain> <Destination> <Salutation>Hi Mark</Salutation> <UniqueID>4120</UniqueID>
0
7504
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7792
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5080
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
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 we have to send another system
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.