How I run maven project in cmd line

I write maven project and I run it in Eclipse but I want to run maven project in using command line so I write

java -jar -Dapple.awt.UIElement="true" target/myproject-1.0-SNAPSHOT.jar -h

line in cmd but I have this error http://i.stack.imgur.com/c03mN.png.

How can I solve it?

Answers


Go to project :

  1. open cmd
  2. cd c:/project
  3. mvn clean install
  4. java -jar -Dapple.awt.UIElement="true" target/myproject-1.0-SNAPSHOT.jar -h

Add this in pom:

    <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>com.kub.App</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
     </plugins>

Are you sure that you are in the correct path for loading the .jar file?

maybe you need something like this?

java -jar -Dapple.awt.UIElement="true" USERS/eclipse-project/projectname/target/myproject-1.0-SNAPSHOT.jar -h 

  1. Please make sure that JAVA_HOME and MAVEN_HOME path are set in environment variables as follows:

    JAVA_HOME: C:\Program Files\Java\jdk1.8.0_181 (Path till JDK folder only not bin folder) MAVEN_HOME: C:\Users\Amit Joshi\Downloads\apache-maven-3.6.0

  2. Add both paths in environment variable 'Path' as follows: %MAVEN_HOME%\bin %JAVA_HOME%\bin

  3. Open your project using IDE (in my case I am using intelliJIDEA)

  4. Click on Run button and copy the command executed in console window.
  5. Open cmd and traverse to the root folder of your maven project.
  6. Paste and execute the copied command and your project will run successfully.

Need Your Help

Download emails (backup) from gmail programmatically

c# email backup gmail imap

Does anyone know a way to execute a bulk dump of every email of a gmail account and write the emails to a file?

iPhone : Using localization change language of an app set it in NSUserDefaults

ios iphone objective-c

Hi friends I am new to iphone. In my project am using localizations to change the language of an app. I done it but the problem. When app gets stopped and run again the language set through localiz...