1

I'm developing an application in Java using Maven. It works on my development computer (Windows) but when I try to run it on a different computer (mac), I get

NoClassDefFoundError: Could not initialize class net.sourceforge.tess4j.TessAPI

I'm new to Maven so I don't know much about how it works but I've tried building with shade and with maven-assembly-plugin but neither worked.

Here is the build section of my pom.xml

<build>
    <resources>
        <resource>
            <directory>src/main/resources/</directory>

        </resource>
    </resources>
    <plugins>
        <!--            The following two plugins were not both run. I had one or the other commented out-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <transformers>
                            <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <manifestEntries>
                                    <Main-Class>com.nanthno.Main</Main-Class>
                                </manifestEntries>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>com.nanthno.Main</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

I've tried solutions on other forum posts but nothing is working. Any and all help is greatly appreciated. (Also this is my first post on StackOverflow so if I should be formatting things differently or anything, let me know and I'll edit the post)

Edit: I tried running the build on a different windows and it worked so it is a mac specific issue.

Nanthno
  • 11
  • 2

0 Answers0