Executing and unit testing an application
There are several ways to execute our new application. In the Building the application section, we saw that all of the compiled classes are stored by IntelliJ IDEA (using the built-in Maven) in the target
folder. This means that we can execute the application by using the java
tool and listing the folder target with the -classpath
option.
To do that, open a Command Prompt or Terminal window and go to the root directory of our new project. If you are not sure where it is, look at the top line of the IntelliJ IDEA window that shows the full path to it. Once you are in the project root directory (it is the folder where the pom.xml
file is located), run the following command:

In the preceding screenshot, you can see that the -classpath
option (we used the short version, -cp
, instead) has listed the directory where all of the classes are compiled. After that, we have typed the name of the com.packt.javapath.ch04demo.MyApplication
main class, because we...