I have a simple example
public class FileSystemReadFile {
public static void main(String[] args) throws IOException {
System.out.println("Reading the file" + args[0]);
}
}
which is created in IntelliJ where I want to build JAR file; So what I did:
- Added Artifact with dependencies (presumably I have some);
- Ensure that
MANIFEST.MF
is located insrc\main\resources\META-INF\
as it is already mentioned somewhere here on the site. - Run Artifact build which gave me JAR file in out folder and I run that jar file that said me "Could not find or load main class"
java <name>.jar
You may see that main class is added into MANIFEST and location of manifest is also fine.
When I open that created JAR file, I see the same MANIFEST content, I see lots of dependency modules, but I don't see my class!
I suspect that is a cause. Any ideas?