java.lang.NoClassDefFoundError (wrong name)

J

John Smith

I have file foo.java that doesn't belong to any package.

in $HOME/scripts/foo.java, I have:


import.com.td.util.*;

bar myBar = new myBar();
myBar.createFile( );


I have verified that bar.class is in
$HOME/java_src/classes/com/td/util

bar.java is located in $HOME/java_src/com/td/util

in bar.java, I have:


import com.td.db.*;

DBConnectionManager loConMgr = DBConnectionManager.getInstance();


I have verified that DBConnectionManager.class* exists in
$HOME/java_src/classes/com/td/db

in $HOME/scripts, I tried:
java -ms256m -mx512m -classpath
".:/app_rre/sybase_client/jar/jconn2.jar:$HOME/java_src/classes" foo

I got:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/td/db/DBConnectionManager (wrong name: DBConnectionManager)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at com.td.util.CSVCreator.createCSVFile(CSVCreator.java:36)
at com.td.util.CSVCreator.createCSVFile(CSVCreator.java:23)
at extract_unrlzd_cash.main(extract_unrlzd_cash.java:29)

Why can't JVM find DBConnectionManager.class in
$HOME/java_src/classes/com/td/db/?

Note that I am *not* allowed to modify bar.java or
DBConnectionManager.java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top