javac is working but not java
PLEASE HELP.
I've got a project due very soon, and I can't get very far until I can run my apps.
Thank you,
Dustin
__
1.
I CAN compile a single .java file if it does NOT refer to any class outside of itself.
2.
I CAN'T compile a .java file if it refers to another class outside of itself (even if it's with in the same directory.
3.
If I comment out the line that refers to an outside class then I can compile the .java file.
HOWEVER, When I run the 'java Ap00.class' command, I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Ap00/class.
This also applies to the above part 1. I can't work the .java command no matter what.
4. Here is my
classpath:
".;C:\j2sdk1.4.1_01\lib;C:\Prog\AudioPlayer;"
Path:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1\ULTRAE~1;C:\Program Files\Common Files\Autodesk Shared\;C:\j2sdk1.4.1_01\bin
They look alright to me.
5. Yes, this program used to run just fine. I have not altered it. Everything got screwy when I upgraded to WinXP.
6. Everything works fine inside of a an IDE like Forte.
Ap.00 compiles and runs.
It seems that the answer is right under my nose, but I just can't put it together.
[1338 byte] By [
lydaya] at [2007-9-28 3:07:26]

Open a console window.
Type the following
echo %CLASSPATH%
The output is your class path. (Do not guess what it is. Follow the above to find out exactly.)
Your classes do NOT have packages right?
You can test a class path with the following even if there is no 'main' in the class.
java MyClass
If you run the above and you get a no class found error, then your class path is wrong. If you get a 'no main' (or it runs) then the class path is right.
This part of your classpath "C:\j2sdk1.4.1_01\lib" is non-sensical. I doubt you are putting your classes in there. And java itself uses jars and that will not pick them up. Remove it.
When you run you are in the directory where the class files are correct? Or they are in "C:\Prog\AudioPlayer"
there is a possibility that u will need to declare a variable in the windows xp directory. windows xp is different from the other versions of windows develop by microsoft. as there is no "real" dos that exists in xp, it is therefore a need to create a temp directory in which your files is to be created and executed.
i hope this really helps. if in any part that i'm wrong...feel free to correct mi. i'm a newbie in java... so i still need to learn a lot from all the java experts here
:)
nicole