I’m trying to communicate with XBee Pro S2 with Digi Java library, but I have a problem to run the project.
I am be able to compile project but not to run it.
I write this command : "sudo java -Djava.library.path=/usr/lib/jni -classpath .:/home/pi/Desktop/XBeeDigi/lib/slf4j-api-1.7.12.jar:/home/pi/Desktop/XBeeDigi/lib/slf4j-simple-1.7.12.jar:/usr/share/java/RXTXcomm.jar Starter
But I have this exception:
Exception in thread “main” java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
But I don’t undestand why, I verified that slf4j-api-1.7.12.jar contains LoggerFactory.class, so why this exception??
Can anyone Help me?
Thanks a lot!
NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at compile time. After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader 3 (in this case java.net.URLClassLoader), which is responsible for dynamically loading classes, cannot find the .class file for the class that you’re trying to use.
NoClassDefFoundError can occur for multiple reasons like
ClassNotFoundException – .class not found for that referenced class irrespective of whether it is available at compile time or not(i.e base/child class).
Class file located, but Exception raised while initializing static variables
Class file located, Exception raised while initializing static blocks