How to fix java.lang.ClassNotFoundException
Aspose.Cells for Java API depends on some additional libraries, if they are missing, an exception may be thrown as “java.lang.ClassNotFoundException”. This article lists such kind of exceptions and explains which libraries are installed to resolve them.
How to fix ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
Aspose.Cells for Java API depends on Bouncy Castle for encryption and decryption features, that is, if the program is required to load or save encrypted spreadsheets, it is required to add reference of bcprov-jdk16-146.jar in the project’s class path.
You may get the java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider.
The solution is actually very simple as detailed below.
- Download any major release of Aspose.Cells for Java.
- Extract the downloaded archive and browse to \JDK 1.6\aspose-cells-x.x.0-java\lib directory.
- Reference the bcprov-jdk16-146.jar in the class path of the project.
Alternatively, you can add the dependency in the pom.xml and let the project resolve the dependency via maven.
<dependencies> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk16</artifactId> <version>1.46</version> <type>jar</type> </dependency> </dependencies>