Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / October 2005

Tip: Looking for answers? Try searching our database.

Eclipse Runtime Error

Thread view: 
Uncle Scotty - 05 Oct 2005 14:28 GMT
I am running Eclipse 3.1.1. I created a project, called PizzaShop.
Inside pizza shop, I have src\ lib\ and build\classes\ folders. Inside
src\, I have a pizza folder for the pizza package. That too is mirrored
in build\classes\pizza.

When I go to debug as ->debug, Eclipse tells me:

java.lang.NoClassDefFoundError: pizza/SystemTest
Exception in thread "main"

What does that mean and how do you tell Eclipse which main to run? I
think I tell it that when it pops open the configuration menu, and I
tell it "pizza.TakeOrder" for the main class to run. But, obviously, it
cannot find the main, and there is a public main() in the TakeOrder
file.

So confused, Scott
Uncle Scotty - 05 Oct 2005 14:30 GMT
As a second resort,  I tried running from the command line like below
and am still getting the same error message! Does that tell me
something useful? When I try to get Eclipse to show me that classfile,
I do get the error message that Eclipse gives me when I try to run
it...

"Class File Editor
Source Not Found
There is no source file attached to this class file SystemTest.class"

When I look in C:\Documents and Settings\Scott
Spiegler\workspace\PizzaShop\src\pizza, I definitely see
SystemTest.java, so I don't understand what it is telling me.

Anyway, here is the error message when I try to run via the command
line...

C:\Documents and Settings\Scott
Spiegler\workspace\PizzaShop\build\classes\pizza
>java SystemTest

Exception in thread "main" java.lang.NoClassDefFoundError: SystemTest
(wrong nam
e: pizza/SystemTest)
      at java.lang.ClassLoader.defineClass0(Native Method)
       at java.lang.ClassLoader.defineClass(Unknown Source)
       at java.security.SecureClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.defineClass(Unknown Source)
       at java.net.URLClassLoader.access$100(Unknown Source)
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Roedy Green - 08 Oct 2005 07:21 GMT
>When I look in C:\Documents and Settings\Scott
>Spiegler\workspace\PizzaShop\src\pizza, I definitely see
>SystemTest.java, so I don't understand what it is telling me.
>
>Anyway, here is the error message when I try to run via the command
>line...

what does your package statement inside SystemTest.java say?
It should say:

package pizza;

Your jar should have a member called  pizza/SystemTest.class
spelled precisely like that. Check with winzip or jar -t to be sure.

where did the compiler put your SystemTest.class file?  If you are not
using a jar, a bad idea when you have classpath troubles, that
directory needs to be on the classpath.

for background see
http://mindprod.com/jgloss/jar.html
http://mindprod.com/jglossjarexe.html
http://mindprod.com/jgloss/package.html
http://mindprod.com/jgloss/classpath.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Fahd Shariff - 08 Oct 2005 14:17 GMT
If SystemTest is in package pizza, then you might want to try doing
this:

C:\Documents and Settings\Scott
Spiegler\workspace\PizzaShop\build\classes> java pizza.SystemTest

Signature

Fahd Shariff



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.