java.lang.NoClassDefFoundError: com/aspose/imaging/n (wrong name: com/aspose/imaging/N)

Dear Friends,


I have a problem when I try to set the license file into a jar file.
When I run the project by eclipse -> run, It’s successful, but when I encapsule my project into a jar file and I try to run it, I get the following runtime exception. Can you help me?

java.lang.NoClassDefFoundError: com/aspose/imaging/n (wrong name: com/aspose/imaging/N)

Thanks.

Hi Leonardo,


Thank you for contacting Aspose support.

I am afraid, we need more information to properly investigate the problem cause. Please confirm the following,

  • Did you re-package or use the extract classes in the jar instead of the original jar as classpath library?
  • Are you using JBoss6 to run your application?

For your information, JBoss6 cannot recognize different classes with same name but different letter cases, such as a.class and A.class, By Java’s specification, aforesaid classes are to be recognized as two different classes and should work together. However, in JBoss6 server the two classes will cause such kind of issue (NoClassDefFoundError wrong name). If you are using JBoss6 then I am afraid, there is nothing that can be done from Aspose.Imaging’s perspective but to upgrade the server to later revisions which resolved this problem.

In case, you are not using the Aspose.Imaging for Java API with JBoss6 server then we need to know how you are using the Aspose.Imaging for Java API in your project, and how you are compiling the application to get a jar. Please provide detailed steps and supporting sample application to replicate the said scenario along with your environment details such as operating system version, JDK type & version etc.

Thanks for reply me.


1) I didn’t extract the aspose jar. I’m using de orignal jar added to classpath, I’m using the jar lib aspose-imaging-2.6.0-jdk16.jar

2) No, I’m not using JBoss. My project generates a jar file and I’,m trying to run it using the jar execute command in java.

For more information, I’m compiling my project in Java 7.

IMPORTANT INFORMATION:

When I change lib aspose-imaging-2.6.0-jdk16.jar to aspose-imaging-2.1.0.0-jdk16.jar, it works fine!!!

I attached a print screen about the trace of the exception. And I attached also the code when I call the setLicense method. The problem occurs there.

Thanks.

Hi Leonardo,


Thank you for the information, however, we still require to know how you compiled the jar, that is; have you packaged the required libraries in the jar. Anyway, attached is a simple sample application along with its runnable.jar that was generated using the Eclipse following the steps shown in the attached snapshot. Please execute the jar as you currently doing and share the snapshot of the output for investigation. In case the issue persists with this jar as well, then execute the java -version command on console and share the result along with the steps to generate the jar on your end.