I'm a Java beginner and have a question similar to the ones here: Java, How to add library files in netbeans? and Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
I followed the answers given there, which were very good, but I still cannot solve my problem.
I'm developing a plugin for GATE in Java using NetBeans 7. I have written this first, trial code:
public class LoadGateDoc {
public static void main(String[] args) throws Exception {
Gate.init(); // prepare the library
Factory.newDocument("This is a document"); // create a new doc
}
}
But when I compile, I get the following error messages:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at gate.Gate.<clinit>(Gate.java:83)
at loadgatedoc.LoadGateDoc.main(LoadGateDoc.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 2 more
Java Result: 1
I have added the "commons-logging" as well as the "org/apache/log4j/Logger" libraries to the properties of my NetBeans project, but this doesn't help, I get the same error messages anyway.
Can you please help me out?