These are two different problems. I'll take each in turn:
Allan Bruce wrote:
> Exception in thread "main" java.lang.NoClassDefFoundError: ClientSide/class
You are confused about the usage of the Java VM. The correct usage is:
java <class name>
You were instead trying to use:
java <class file name/path>
That isn't the way things work, though. You give the Java VM the name
of a class to start with, and it finds the corresponding class file
through all the usual means (the classpath, the boot classpath, the
extensions directory, etc.). So, since you've written a class called
'ClientSide', it needs to be run as 'java ClientSide', NOT
ClientSide.class.
In Java class names, a period indicates a package, and the latter
command is causing the VM to look for a class called 'class' in a
PACKAGE called 'ClientSide'. It's not surprising that it can't find
such a thing.
Now, on to the next problem:
> java.lang.NoClassDefFoundError: Declan/ClientSide (wrong name: ClientSide)
Here, you've got a mismatch between the locations of your files and the
packages of the classes that they contain. You've written a class
called ClientSide, and then tried to run it as if it were a class called
'Declan.ClientSide'. Apparently, you've also moved the compiled class
file into a directory called Declan. But you haven't changed the
package declaration in the source file.
A class's package and the location of its class file must match. Either
move the class back to its original position and run it from the default
package, or change it package declaration to the package you want it to
reside in.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation