I have added a piece of sharepoint code to the existing java file which was compiling and working fine. The sharepoint code that is written uses some of the external libraries. Now I need to add the external library to the existing project through ANT.
I have done a few modifications in the build.xml file and hence resolved all the compilation errors. However when the code is getting executed, I get an Error message saying "java.lang.NoClassDefFoundError: net/entropysoft/eci/spi/IContentProviderFactory". Please help me resolving this error.
Also please let me know what needs to be added in the build.xml file to resolve the error. All 开发者_开发百科the jar files is present in the directory "externallibs"
Thanks, Rajath
You need to have all the jars in the classpath when running the application:
java -cp externallibs/* com.foo.bar.Main
If it's a Java EE web application, the build process should copy all these jars to the WEB-INF/lib
folder of the generated web app structure.
java.lang.NoClassDefFoundError: net/entropysoft/eci/spi/IContentProviderFactory
does not mean the class net.entropysoft.eci.spi.IContentProviderFactory
is not found. It means the class that is used within this class are not found anywhere in the classpath. This error is thrown when the class loader is trying to load the class but it cannot properly initialize the class definition.
To solve this problem, you will need to look at the source code of the class net.entropysoft.eci.spi.IContentProviderFactory
, usually at the import section, and determine what is the missing Java class and which library the missing class is in. Once you know you can add that library to your classpath using the answer by JB Nizet. If you run it from IDE, then you will need to add that library to you build.xml.
精彩评论