This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Strange Error..." Watch "Strange Error..." New topic
Author

Strange Error...

Jayanath
Greenhorn

Joined: May 21, 2004
Posts: 10
Hi,
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,
Jayanath.

import java.io.*;
public class test
{
public static void main(String arr[])
{
System.out.println("testing ");
}
}
Lalita Sattavat
Greenhorn

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

set CLASSPATH=.;%CLASSPATH%;

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

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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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


[Jess in Action][AskingGoodQuestions]
Seema Sehgal
Greenhorn

Joined: May 27, 2004
Posts: 2
hi
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 "test.java".sumtimes while working with notepad u have to store file with double quotes like "test.java" while saving because sumtimes if u store file as test.java in notepad then the filename might be taken up as test.java.txt...so keep this too in mind.

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

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: http://aspose.com/file-tools
 
subject: Strange Error...
 
Similar Threads
Annonynous inner class error
protected access level
Running a class in a package
java lang NoClassDefFoundError
why is this array code creating error