I am new to Java programming.
I have J2SDK1.5.0 in my machine
I was able find C:\Program Files\Java\j2re1.5.0 and C:\Program Files\Java\j2sdk1.5.0 and their respective folders with file.
I was trying to compile some java file which has log4j calling
The file Log4jDemo.java contains the following:
import org.apache.log4j.Logger;
public class Log4jDemo {
static Logger log = Logger.getLogger("Log4jDemo");
public static void main(String args[]) {
log.debug("This is my debug message.");
log.info("This is my info message.");
log.warn("This is my warn message.");
log.error("This is my error message.");
log.fatal("This is my fatal message.");
}
}
Before compiling i have extrated the log4j.jar from apache site file and kept at "C:\Program Files\Java\j2sdk1.5.0\lib" folder
I am able to compile file by
C:\Program Files\Java\test>javac -classpath "C:\Program Files\Java\j2sdk1.5.0\lib\log4j.jar" Log4jDemo.java
But when i do
C:\Program Files\Java\test>java Log4jDemo
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at Log4jDemo.<clinit>(Log4jDemo.java:5)
Why this error is coming?
please do help in resolving this ....
Regards,
Rk
I have J2SDK1.5.0 in my machine
I was able find C:\Program Files\Java\j2re1.5.0 and C:\Program Files\Java\j2sdk1.5.0 and their respective folders with file.
I was trying to compile some java file which has log4j calling
The file Log4jDemo.java contains the following:
import org.apache.log4j.Logger;
public class Log4jDemo {
static Logger log = Logger.getLogger("Log4jDemo");
public static void main(String args[]) {
log.debug("This is my debug message.");
log.info("This is my info message.");
log.warn("This is my warn message.");
log.error("This is my error message.");
log.fatal("This is my fatal message.");
}
}
Before compiling i have extrated the log4j.jar from apache site file and kept at "C:\Program Files\Java\j2sdk1.5.0\lib" folder
I am able to compile file by
C:\Program Files\Java\test>javac -classpath "C:\Program Files\Java\j2sdk1.5.0\lib\log4j.jar" Log4jDemo.java
But when i do
C:\Program Files\Java\test>java Log4jDemo
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at Log4jDemo.<clinit>(Log4jDemo.java:5)
Why this error is coming?
please do help in resolving this ....
Regards,
Rk