Cannot Run Compiled Jar Files

Answered

I've been trying to build a project for a little while now. Whenever I build the jarfile and try to run it from the command line, I see a ClassNotFoundException, and the same holds true for when I try to run the jarfile from intellij itself. The ClassNotFound is *not* one of the dependency classes. It is the main class of the whole program. When I manually open up the jar to see what's in it, I can, quite clearly, see that the class in question is inside of the jar and is in the correct location. The Manifest file has the correct Main-Class attribute, and the package statement in my main class is correct. As such, I am very confused as to why nothing is working.

0
3 comments

I'll go through that list right now to see if one of those things apply:

Wrong main class selected? No.

Main class excluded from compilation? No

Build step is excluded? No.

Project is misconfigured, no source root? No. Definitely have source root.

Main class has incorrect package statement? No.

Project path contains colon? No.

Dependent jar is digitally signed? Not the current issue. The current issue pertains to the main class, not any of the dependencies.

0

The error is the same if any dependency is signed, see https://stackoverflow.com/a/45169655/104891.

Anyway, we can't help until you share a sample project: https://intellij-support.jetbrains.com/hc/articles/206869619 .

0

Please sign in to leave a comment.