Link to home
Start Free TrialLog in
Avatar of laes_
laes_

asked on

NoClassDefFoundError in eclipse

i make a new java project in eclipse from external folder
every thing is nice
but when i configure the run to the main class
it shows this execption NoClassDefFoundError
it is really amazing,everyt thing seems OK,why it didnt find the class
thank u for ur help
Avatar of bloodredsun
bloodredsun
Flag of Australia image

You're missing some classes/jars on the classpath

add it to the project. Right click the project/java compiler/build path/add jar
more acurately:

[Right click your project]/properties/Java Build Path/Libraries Tab/Add JARS or Add External JARS
Avatar of edwardiii
edwardiii

Hi, laes.

How did you set up a new project in Eclipse?  Please list the exact steps you took, and list the complete name of your java file, where it is on your hard drive, what package it is in, and the literal syntax you used to try to compile it.  
Eclipse uses Plugins, are u doing anything in your code that requires Plugins ? visit the web site for the list of plug-ins.
good luck.
Avatar of laes_

ASKER

hi,thyank u for ur comment
>>more acurately:
file ->new->project->java project->i put the project's name and  create projet at external location ,i browse to the worspace containing the folder->i added required jar file .
.

Ok, if you're creating a jar, follow the steps listed in the "Accepted" answer here: https://www.experts-exchange.com/questions/21279937/how-to-make-an-exe-of-my-java-application.html 

Follow the steps, and let us know your results.
Avatar of laes_

ASKER

no i 'm not creating a jar file,all jar file are ready
my problem is that i define a new project based on exetrnal folder
when i call the main class,it raises an execption,despite of the fact that the class exists !,
NoClassDefFoundError
Avatar of laes_

ASKER

suppose that i have one folder conatining all packaeges and classes
i want to make a new project based on this folder
so what i must do more than
file ->new->project->java project->i put the project's name and  create projet at external location ,i browse to the worspace containing the folder->i added required jar file .
that is my question
I'm guessing your issue is the Jar you create doesn't work.  Apparently you've already followed bloodredsun's advice and/or you've done what you detailed above (e.g. "create project at external location"), and you can run your class file within Eclipse, is that right?  If so, the problem to decipher is why you can't create a workable Jar.  If that is the case, can you list verbatim the steps you took to create your Jar (feel free to reference the post I noted previously).  If that is not the case, please tell us where you're running into a wall with Eclipse and what errors/results you're getting.
Avatar of laes_

ASKER

if i have a folder containing all that classes into subfolder(package)
and i follow that steps ,create project at external location...
 (the jar file that i posted in the previous comment are those that classes needed
not a jar file witch result from archiving the folder containing all classes)
i want to know what i must do in addition to this?
>>what errors
the exception that it raises is:
Exception in thread "main" java.lang.NoClassDefFounfError : <path of the main class>
ASKER CERTIFIED SOLUTION
Avatar of edwardiii
edwardiii

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial