Kevin
Kevin

Reputation: 6302

How to run maven built class in command line

I have a class file build by maven. It is just one class with main method in it. The file situates under:

<projectRoot>/target/classes/com/myproject/client/MyClass.class

The class is in package:

com.myproject.client

The class has no dependency on other classes.

My question is that how can I run it using the "java" command line.

Many thanks.

Upvotes: 0

Views: 77

Answers (1)

Oleg Gryb
Oleg Gryb

Reputation: 5259

Try this:

java -cp "<projectRoot>/target/classes" com.myproject.client.MyClass [optional arguments]

Upvotes: 2

Related Questions