I tried to use a static inner class as the Main Class of a jar artifact with IntelliJ (Java 8). The inner class is something simple like this:
public class Outer {
public static class Inner {
public static void main(String[] args) {
//do something
}
}
}
And the compiler seems to translate the inner class by creating a new class "Outer$Inner" in the same package:
pack
Outer.class
Outer$Inner.class
So when you create a MANIFEST.MF with the inner class as the main class, it should look like this:
Manifest-Version: 1.0
Main-Class: pack.Outer$Inner
This was also what was working for me. However, when I use the Artifact Dialog from IntelliJ, it separates the Inner class from the Outer class with a dot "." instead:
Which means the MANIFEST.MF also has the dot:
Manifest-Version: 1.0
Main-Class: pack.Outer.Inner
And this does NOT work, if I try to run the compiled jar with this Manifest, it tells me that it didn't find class "pack.Outer.Inner". Which makes sense, because that class doesn't even exist in compiled form. And if I manually change the "pack.Outer.Inner" to "pack.Outer$Inner", IntelliJ doesn't understand it and will highlight it in red (although it compiles and runs anyways).
Is this an IntelliJ bug, or am I doing something wrong?
