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]
# 1
In case it might be of relevance, I'm using jdk 1.4.02 on win 2000 and I'm using JBuilder 4.Pete
Pete_M at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2
from the directory where the class file exists:java -classpath whatever;. packagename.packagename.Application1I think!
mistertak at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3

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

wei32607 at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 4
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.
DrClap at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 5
It does, my classpath is set to the directory which contains the package.Wei
wei32607 at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 6
In a DOS window, enter "set" or "set classpath" and DOS will display the current Classpath. My bet is on Dr. Clap - it will not display c:\ as a directory in the current Classpath. You might try:java -classpath c:\ webDeveloper/javaPractice/myProject/MyProject
atmguy at 2007-7-7 13:09:42 > top of Java-index,Archived Forums,New To Java Technology Archive...