Problem running a package with command line
I have a package that I have compiled and run with JBuilder. I would now like to do the same with the command line. The package is called topasthread and the three files are Application1.java, Frame1.java and DBConnection.java. The DBConnection needs to import C:\mysqlDriver\mysql-connector\mysql-connector.jar for the driver.
I switch to D:\Java and compile the package with:javac -classpath C:\mysqlDriver\mysql-connector\mysql-connector.jar topasthread\*.java
This works no problem. Now I try to run the application with java topasthread.Application1
This produces the error:Exception in thread"main" java.lang.NoClassDefFoundError: topasthread/Application1
I'm not really a newbie but i must be making such a basic mistake. I've used packages for JSP but this is the first time with an application. Can anyone help me, please?
Pete
[903 byte] By [
Pete_M] at [2007-9-27 22:31:31]

I have a exactly the same problem.
Here is my directory structure: c:\webDeveloper\javaPractice\myProject
and I create a package named MyProject the file header looks like this:
package webDeveloper.javaPractice.myProject
public class MyProject extends ....
then I compile it fine but runs with famous: Exception in thread "main" java.lang.NoClassDefFoundError: webDeveloper/javaPractice/myProject/MyProject.
I tried to reset the CLASSPATH to the current directory but still no luck.
I have other apps in the same directory runs fine without using package.
what did I do wrong?
thanks,
Wei
Your classpath needs to include the directory that contains the package, not the directory that contains the classes in the package. In this case your package is webDeveloper/javaPractice/myProject, and the directory that contains that is C:\. So C:\ needs to be in your classpath.