Eclipse Runtime Error  
Author Message
Uncle Scotty





PostPosted: 2005-10-5 21:28:00 Top

java-programmer, Eclipse Runtime Error 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





PostPosted: 2005-10-5 21:30:00 Top

java-programmer >> Eclipse Runtime Error 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





PostPosted: 2005-10-8 14:21:00 Top

java-programmer >> Eclipse Runtime Error On 5 Oct 2005 06:30:27 -0700, "Uncle Scotty"
<email***@***.com> wrote or quoted :

>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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
 
Fahd Shariff





PostPosted: 2005-10-8 21:17:00 Top

java-programmer >> Eclipse Runtime Error 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

--
Fahd Shariff