File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Strange Error... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 24057
    
  13

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Strange Error...
 
Similar Threads
protected access level
why is this array code creating error
Annonynous inner class error
Running a class in a package
java lang NoClassDefFoundError