my code is here
-------------------------------------------
class ILoveJava {
public static void main(String[] args) {
System.out.println("I Love Java!");
}
}
---------------------------------------
when i compile it is showing NO errors. when i run the program using
java ILoveJava
i get this error.
----------------------------------------
Exception in thread "main" java.lang.NoClass.DefFoundError: ILoveJava
----------------------------------------
How to solve this problem ?
opalpa@gmail.com opalinski from opalpaweb - 21 Jan 2006 16:23 GMT
If you receive this error, java cannot find your bytecode file.
Read up on changing value of CLASSPATH variable.
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.htm
has documentation for a few different systems.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
snowy - 21 Jan 2006 16:30 GMT
hi but the link is broken. i am using winxp. pls help me. i get
compilation correctly but the program is not running.
Chris Smith - 21 Jan 2006 17:35 GMT
> hi but the link is broken. i am using winxp. pls help me. i get
> compilation correctly but the program is not running.
Try java -cp . ILoveJava

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
opalpa@gmail.com opalinski from opalpaweb - 21 Jan 2006 18:04 GMT
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
I missed a character at the end. I checked the above link.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Jeffrey Schwab - 21 Jan 2006 17:34 GMT
> my code is here
>
[quoted text clipped - 19 lines]
>
> How to solve this problem ?
java -cp . ILoveJava
Java doesn't know to look in the current directory for the class
definition. Add the current directory (".") to the class path using
either the -cp command line flag or the CLASSPATH environment variable.
opalpa@gmail.com opalinski from opalpaweb - 21 Jan 2006 18:12 GMT
Java looks into current directory if CLASSPATH variable is not set.
When CLASSPATH variable gets set then the stuff in CLASSPATH variable
gets used. WHen CLASSPATH gets unset then current directory gets used.
One can also add current directory, with a ".", to the CLASSPATH
variable.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Jeffrey Schwab - 21 Jan 2006 21:49 GMT
> Java looks into current directory if CLASSPATH variable is not set.
> When CLASSPATH variable gets set then the stuff in CLASSPATH variable
[quoted text clipped - 6 lines]
> opalpa@gmail.com
> http://www.geocities.com/opalpaweb/
Would ya believe I didn't know that? Thanks!
Roedy Green - 21 Jan 2006 22:57 GMT
>NoClass.DefFoundError
see http://mindprod.com/jgloss/caq.html
http://mindprod.com/jgloss/gettingstarted.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.