File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Strange Error... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Strange Error..." Watch "Strange Error..." New topic

Strange Error...


Joined: May 21, 2004
Posts: 10
Im using j2sdk1.4.0
when Im compiling this small class it get compiled.
when I try to execute it it gave me an error saying,

Exception in thread "main " java.lang.NoClassDefFoundError :test

Whats wrong with this???
Pls help me to clarify this strange error...

Thanx in advance for any comments,
best regs,

public class test
public static void main(String arr[])
System.out.println("testing ");
Lalita Sattavat

Joined: May 31, 2004
Posts: 10
set ur classpath to current directory. which means execute the following on the command prompt


note: use ';' if ur working on windows and ':' if ur working on linux

now it should work fine
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Moving this to Java in General (Beginner) for follow-ups.

[Jess in Action][AskingGoodQuestions]
Seema Sehgal

Joined: May 27, 2004
Posts: 2
well, it seems you have not set your classpath and if u did so check r u storing your file with a same name as of class as "".sumtimes while working with notepad u have to store file with double quotes like "" while saving because sumtimes if u store file as in notepad then the filename might be taken up as keep this too in mind.

hope it solves your problem..all the best..
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
As suggested above, I'd bet your CLASSPATH value could use changing. For an explanation of just what the CLASSPATH is, as well as for instructions on how to set it on different operating systems, take a look at our FAQ on HowToSetTheClasspath.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Strange Error...
It's not a secret anymore!