Forrest logo
back to the mvn tool

mvn:tldr:0268a

mvn: Run a class with a main method.
$ mvn exec:java -Dexec.mainClass="${com-example-Main}" -Dexec.args="${arg1 arg2}"
try on your machine

This command is used to execute a Java application with Maven (Maven is a build automation tool primarily used for Java projects). Here's the breakdown of the command:

mvn exec:java - This is the Maven command to execute a Java application using the exec:java plugin.

-Dexec.mainClass="${com-example-Main}" - This option specifies the main class of the Java application that needs to be executed. Replace ${com-example-Main} with the actual fully qualified name of the main class.

-Dexec.args="${arg1 arg2}" - This option specifies the command-line arguments that need to be passed to the Java application. Replace ${arg1 arg2} with the actual command-line argument values. Multiple arguments should be separated by a space.

Overall, this command sets up the Maven environment to run a Java application using the specified main class and command-line arguments.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mvn tool