Missing class from package within Netbeans when using Spire.Doc.jar for docx files

206 Views Asked by At

I downloaded and installed the free Spire.Doc.jar file to work with .docx files. When I run it within Netbeans the functionality works fine however when I attempt to build the program I am getting the following error:

warning: Supported source version 'RELEASE_6' from annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' less than -source '1.8' Note: Creating static metadata factory ... error: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.spire.doc.packages.spryOb$1 not found

An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for com.spire.doc.packages.spryOb$1 not found

I have added the .jar file to my class path however there appears to be a class file missing from the com.spire.packages location.

Does anyone know if this is a Netbeans issue or does it look like there is an issue with the .jar file? I find it strange that it works when I run it within Netbeans but the above error occurs when I attempt to build the project.

1

There are 1 best solutions below

0
On

I managed to get my application to build. What I had to do was remove the following code from my class and then it worked:

document.getMailMerge().MergeImageField = new MergeImageFieldEventHandler()
{  
            @Override  
            public void invoke(Object sender, MergeImageFieldEventArgs args)
            {  
                mailMerge_MergeImageField(sender, args);  
            }  
};  

private static void mailMerge_MergeImageField(Object sender, MergeImageFieldEventArgs field)
    {  
        String filePath = field.getImageFileName();  
        if (filePath != null && !"".equals(filePath))
        {  
            try
            {  
                field.setImage(filePath);  
            }
            catch (Exception e)
            {  
                e.printStackTrace();  
            }  
        }  
    }

I'm not sure why it didn't work with this included however I got this code from the following website:

https://www.c-sharpcorner.com/article/how-to-perform-mail-merge-in-word-document-in-java/

therefore I will inform them in case this happens to someone else in the future.