I can't seem to solve this issue. Running com.benmyers.Main in IntelliJ with a Maven dependency works fine, and I receive no errors. When I use the Install tool in the Maven window to create an executable JAR file in the target directory, I receive the following error when attempting to run
java -jar "C:\Users\...\target\AncientGreekTranslator-1.0-SNAPSHOT.jar"
in Command Prompt:
Exception in thread "main" java.lang.NoClassDefFoundError: com/formdev/flatlaf/FlatDarculaLaf
        at com.benmyers.Main.main(Main.java:23)
Caused by: java.lang.ClassNotFoundException: com.formdev.flatlaf.FlatDarculaLaf
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 1 more
I believe there is an issue with the Maven plugin in pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>benlmyers.ancientGreekTranslator</groupId>
    <artifactId>AncientGreekTranslator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.formdev</groupId>
            <artifactId>flatlaf</artifactId>
            <version>0.43</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>
I have tried the following:
- Adding - <scope>provided</scope>to the dependency in- pom.xml(from this answer), which causes no visible change when running the JAR in Command Prompt, and
- using - <artifactId>maven-plugins</artifactId>instead of- <artifactId>maven-jar-plugin</artifactId>among other- artifactIds. Basically, I tried the answers from this question and this other question but had no success.
I've received a comment requesting for my Main.java:
public class Main {
    private static GreekDictionaryInterpreter dictionaryInterpreter;
    private static Translator translator;
    private static MainForm mainForm;
    public static void main(String[] args) {
        dictionaryInterpreter = new GreekDictionaryInterpreter(new ArrayList<Flag>());
        translator = new GreekTranslator(dictionaryInterpreter.getDictionary(), new ArrayList<Flag>());
        FlatDarculaLaf.install(); // <- Line that causes exception
        //LookAndFeelManager.setLookAndFeel();
        MainForm.main(dictionaryInterpreter, translator);
    }
}
There are other answers for this, and I've searched through several and none of them have proven to be successful in my case. Any help would be greatly appreciated.
 
    