Exception in Thread main

After compiling the programming under DOS-prompt,getting the "Exception in Thread main:java.lang.NoClassDefFoundError",please explain the reason behind this error?The program is not running after getting this Error.
yugandharAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yugandharAuthor Commented:
This is very nice site to find for getting  answers.Thanks for introducing this site.Please reply me as early as possibe.
0
vladi21Commented:
specify CLASSPATH
0
Ravindra76Commented:
Hi yugandhar,

1. The exception will come when the class you are trying to run is not  in your classpath.

Check wheter the current directory was set in classpath.

like

classpath = .;c:\jdk118\lib\classes.zip;
.. indicates current directory

2. Check the file name  and class name in that file name which contain

public static void main(String args[]) is same or not.

Best of luck
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

sgomsCommented:
The possible reasons cud be,

1. Classpath was not set properly
    jdk1,2 does not use classes.zip in that case u shud set the classpath to java_home\lib;
i.e
SET CALSSPATH=C:\JDK1.2\LIB;


2. Java compilation is done thru,
    >javac XXX.java
   Java execution is done thru
   >java XXX
 
NOTE: please make sure that u did not say java XXX.class
..class shud not be given while running ur program

-sgoms
0
Jan LouwerensSoftware EngineerCommented:
.and the obvious, of course: make sure the class you are trying to run actually contains a 'main' method
0
shaveriCommented:
set your classpath variable,for more ref.visit the foll..site
http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/classpath.html
0
sgomsCommented:
shaveri, setting the correct classpath has been stated by many experts. what made u propose an answer? please post a comment & let the person who asked the question decide for himself/herself which is a suitable answer.

no offense meant.
-sgoms
0
yugandharAuthor Commented:
shaveri,
 You proposed the  same answer as others  did.I am sorry to say it is not appropriate. Thank you.
 yugandhar
0
sgomsCommented:
did u chk whether u stated it as java <filename> or java <filename>.class??

does the problem still persist?

-sgoms
0
sgomsCommented:
did u chk whether u stated it as java <filename> or java <filename>.class??

does the problem still persist?

-sgoms
0
yugandharAuthor Commented:
Regarding my question ,the problem is
still there,Igot over that problem last
week.Now recurring ,the same.the question no.is 10246200-2290141.Thankful to all who answered this  Qn.I will  add 60 pts.if i get
 correct answer.
0
Ravindra76Commented:
Hi,

 Once post

 Your classpath,path and your code and filename.

IT's a very simple problem.

BEst of luck
0
sgomsCommented:
post your classpath,path and your code and filename & ur steps.

-sgoms
0
vivexpCommented:
Hi,

I agree with what ever sqoms says.r all ur programs not running or only this prg.

check the declaration of main().
It should be
 public static void main(String args[]){

   //code.........

}

Set the class path in ur Autoexec.bat as:

path=C:\jdk1.2\bin;C:\jdk1.2\lib

Run the Autoexec.bat once......

Even then if u r getting the problem check installation of JRE and jdk1.2.

Else post ur code....


Try it..............

0
vivexpCommented:
Hi,


Thrown if the Java Virtual Machine or a classloader tries to load in the definition of a class (as part of a normal method call or as
part of creating a new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.


If not satisfied Post ur code...

Bye...



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.