I'm using Eclipse in order to compile & run Java applications. I'm creating several projects, which I export as a jar file and import (add to build path) them as jar file in the other projects. I add the jar as follows:
It is my first time I'm getting this error:
java.lang.NoClassDefFoundError
I created a project which uses POI jars. The project name is "A". I export this project to A.jar file and import it (add to build path) in B project. When I'm running the B project and try to init (call the constructor) of an object from A.jar, I'm getting the following error:
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/CellStyle
I checked the following threads:
But didn't find the answer.
Why am I getting this error? It isn't my first time, that I'm importing/adding to build path. But now I'm getting an error.
How can I solve it?
You get the error, because the classloader do not find the class.
You have to add the jar that containing the class poi-<version>.jar
to the classpath.
The build path only defined the path for the compiler. It not define that the class is in the classpath at runtime.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.