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/
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
Add both paths in environment variable 'Path' as follows:
%MAVEN_HOME%\bin
%JAVA_HOME%\bin
Open your project using IDE (in my case I am using intelliJIDEA)
Click on Run button and copy the command executed in console window.
Open cmd and traverse to the root folder of your maven project.
Paste and execute the copied command and your project will run successfully.
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
Please check for more informations here.
You can run mavan spring-boot project using the following command
mvn spring-boot:run
Go to project :
cd c:/project
mvn clean install
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>
You have called the java command from an incorrect path ( i.e., Windows/system32 ) instead of your projects base directory .... cd to your projects base directory and try again .... That might solve your problem ....