Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Package Problems

0 views
Skip to first unread message

Alex

unread,
Jun 23, 2006, 9:45:57 AM6/23/06
to
Hi,

I am trying to put some java files into a package however it is causing
me problems.
I have 4 JAVA Files called Node, Tree, Coalesce and Utilities. When I
put them into a package (called webb.tree) and compile them, they
compile but when I try to run the class with the main function in I get
this error:

Exception in thread "main" java.lang.NoClassDefFoundError: Coalesce
(wrong name:
webb/tree/Coalesce)
at java.lang.ClassLoader.defineClass1(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)

However if i simply remove from each of the 4 files the line "package
webb.tree;" they compile and run fine. What am I doing wrong with the
packages?

Thanks,

Alex

Message has been deleted

Paul Hamaker

unread,
Jun 23, 2006, 4:49:14 PM6/23/06
to
You run it like this :
java webb.tree.Coalesce
from the directory where the webb directory is in ?
--------------------
Paul Hamaker, SEMM, teaching ICT since 1987
http://javalessons.com

Alex

unread,
Jun 26, 2006, 6:42:58 AM6/26/06
to
That seems to work! Thanks :)
0 new messages