@ximaawa
Hello,
Thank you for reaching out to us regarding the issue you’re experiencing with Aspose.Font for Java 25.x.
The error you’re encountering, java.lang.NoClassDefFoundError: com/aspose/font/internal/util/logging/Logger
, suggests that the necessary logging class is not present in the JAR file.
Steps to Resolve the Issue
1. Verify your Project Dependencies
Ensure that your project has the correct dependencies. Here’s an example pom.xml
for Maven:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-font</artifactId>
<version>25.6</version>
</dependency>
2. Download and Reinstall
Sometimes, the issue could be due to a corrupted JAR file. Try deleting the current JAR file and re-downloading it. Ensure you’re downloading the correct version from the Aspose official website.
3. Verify Classpath
Make sure that the classpath includes all the necessary dependencies. For framewoks like Maven, ensure there are no version conflicts in pom.xml
.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-font</artifactId>
<version>25.6</version>
<classifier>jdk16</classifier> <!-- If you are using JDK 16 -->
</dependency>
4. Update Java Development Kit (JDK)
Ensure that you are using a JDK compatible with Aspose.Font. We recommend using the latest version of Java, unless there’s a specific requirement to stay on an older version.
Example Code
Here is a sample code snippet to correctly set the license:
import com.aspose.font.License;
public class Main {
public static void main(String[] args) {
try (final var is = Main.class.getClassLoader().getResourceAsStream("Aspose.Total.lic")) {
new License().setLicense(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}
References:
Next Steps
If the problem persists after completing these steps, please share more details about your development environment, including:
- Java version
- IDE and build tool (Maven/Gradle/Eclipse, etc.)
- Complete stack trace
This additional information will help us diagnose the issue further and provide a more tailored solution.
We appreciate your patience and cooperation.
Best regards,