1

For my own understanding, I'd like to know the "magic" behind the Command Line App template in IntelliJ.

Here's what it looks like when you create a new project from it:

working version

Here's what happens when I attempt to do it:

not working

In the template version, there's a special blue src icon, com and aaronshaver are packages, and Main has a Java class type icon without a .java extension.

In my version, none of that, and it can't find the package name.

I tried New -> Module but only ended up with a weird "com.aaronshaver" package.

How can I replicate what the template is doing?

Aaron
  • 2,154
  • 5
  • 29
  • 42

1 Answers1

1

The easiest way to solve this is: right click on "src" -> Mark Directory as -> Sources Root.

That then also makes "com" and "aaronshaver" in this example as packages.

In the run configuration you can then use "com.aaronshaver.Main" as the Main class.

Thanks to Ben Sch for the suggestion.

Aaron
  • 2,154
  • 5
  • 29
  • 42