twc
Posts: 129
Nickname: twc
Registered: Feb, 2004
|
|
Re: Classpath Question
|
Posted: Mar 19, 2004 7:00 PM
|
|
> I'm trying to run a class through the command line. I > figured out how to do this if the compiled class isn't > part of a package. However, I'm unable to do this if it > is. I'm using JDK 1.4.1 by the way. > > My java file is called "SpellCheck.java". The "package" > it's in is "projsp". Thus, the start of file > "SpellCheck.java" looks like this... > > package projsp; > > My (relevant) classpath is "C:\Kevin\Java Projects;" > > I copied the compiled class to directory "C:\Kevin\Java > Projects" and to "C:\Kevin\Java Projects\projsp" (just to > be safe). > > On the command line I tried typing the following 2 things > and both returned the same error... > java SpellCheck > > java -ea:projsp:SpellCheck > > THE ERROR I GET IS THE FOLLOWING... > Exception in thread "main" > java.lang.NoClassDefFoundError: SpellCheck (wrong name: > projsp/SpellCheck)
I see two potential problems. 1. Did you mean to type colons? I suspect you need a space between -ea and propjsp and a period between propjsp and SpellCheck. (I'm not familiar with -ea, so I don't know what affect it may have.)
2. Where is your command prompt when you try to run it? If your source code files are in "C:\Kevin\Java Projects\", then the compiled files should end up in "C:\Kevin\Java Projects\projsp", but you will need to run the command prompt while in "C:\Kevin\Java Projects\".
Try java -ea propjsp.SpellCheck from "C:\Kevin\Java Projects\"
|
|