wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Javac cant find my class?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Javac cant find my class??" Watch "Javac cant find my class??" New topic
Author

Javac cant find my class??

frank rizzo
Greenhorn

Joined: Jan 14, 2002
Posts: 4
Hi, I've got jdk1.3.1 on W2000, just trying to run a simple helloworld to verify Java is running (then hook it up to PHP)...
I have a simple class javaTest in c:\java
when I type any of the following:
java javaTest
java c:\java\javaTest
c:\jdk1.3.1\bin\java javaTest
c:\jdk1.3.1\bin\java c:\java\javaTest
I get the message:
Exception in main...noClassDefFound...
It's a clean, fresh install of Java, and I'm not sure where to look next. Any ideas please??
...as an aside, something not directly related to this bboard, I encountered this when I tried hooking Java into the php.ini file so that PHP can access Java classes. When I use the line "extension=php.java.dll" it causes PHP to hang. any addidtional info on this would be appreciated....
Thanks a lot
Frank Rizzo
[ January 14, 2002: Message edited by: frank rizzo ]
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Is your CLASSPATH set? If so, does it include the directory where your test code resides?


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
frank rizzo
Greenhorn

Joined: Jan 14, 2002
Posts: 4
Originally posted by Michael Ernest:
Is your CLASSPATH set? If so, does it include the directory where your test code resides?

The classpath is c:\jdk1.3.1\jre
JAVA_HOME is c:\jdk\1.3.1
most but not all of the applets work in the demo, and the test program works on another machine...

Frank Rizzo
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
If it is javac that can not find your class, then it is the path parameter that needs modifying. You need to be sure that it includes c:\jdk1.3.1\bin
The path statement helps the system find the executables like javac.exe, the classpath helps locate the classes that might be pulled into a compile or execution.
PS - applets are another issue. They have settings in the registry that tell them where to find the classes. Do you have the 1.3 plug-in for browsers installed?
[ January 14, 2002: Message edited by: Cindy Glass ]

"JavaRanch, where the deer and the Certified play" - David O'Meara
frank rizzo
Greenhorn

Joined: Jan 14, 2002
Posts: 4
Originally posted by Cindy Glass:
If it is javac that can not find your class, then it is the path parameter that needs modifying. You need to be sure that it includes c:\jdk1.3.1\bin

Path includes c:\j2sdk1.4.0-beta3\bin\
(re-installed java just to see if it would work)
When I try to run the program w/verbose, it loads everything up like normal, till it gets to my class, and then it can't find it.
I CAN javac the file and it compiles correctly into my directory.
btw thanks a lot for your suggestions.... is there anything else on the machine that you could think of, that would influence java from the command line??
Frank Rizzo
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
I believe you need a . in your classpath, along with the directory where JDK resides.
e.g. .;C:\jdk1.3.1\lib\tools.jar;
HTH
frank rizzo
Greenhorn

Joined: Jan 14, 2002
Posts: 4
Yes, that was it. the "." made it work.
much thanks to all of you for helping
Frank Rizzo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javac cant find my class??
 
Similar Threads
Java JDK Installation Problem - Need Help!
javaw and java -jar
running Java from command line
PLS help -urgent Prob with headfirst Advice
I feel kinda dumb but...