0

I'm using IntellIj to try and create a runnable Jar out of my program. I've gotten a runnable jar to execute in cmd correctly for a simple hello world program, but when I try doing the same exact steps for the larger project I get the Error:

Error: Could not find or load main class com.abc.project.directory.SomeClass

I've checked my MANIFEST.MF:

Manifest-Version: 1.0
Main-Class: com.abc.project.directory.SomeClass

Which has that exactly. The main class I selected to build the artifact off of is also 'com.abc.project.directory.SomeClass' exactly. I've tried just about everything like moving the META-INF folder to the same exact directy where SomeClass.java is, using different directories, using default directories, etc. to no avail.

Not too sure where I am going wrong, any help would be great!

My project basically mirrors this functioning Hello World test below: enter image description here

  • 1
    See https://stackoverflow.com/a/42660624/104891, https://stackoverflow.com/a/42200519/104891 and https://stackoverflow.com/a/45169655/104891. If the issue persists, please zip and share a sample project to reproduce it ([Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve)). – CrazyCoder Oct 08 '20 at 21:59
  • 1
    Hi, if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – YourHelper Nov 05 '20 at 22:24

1 Answers1

0

click file>export and select your option to create the final executable

the problem happens because you have created a class which is in another directory than the others.Intellij can compile the file correctly if you follow the steps

YourHelper
  • 703
  • 7
  • 17