0

I am working in Java Maven project. There is a .bat file in the root of the project which invokes a Java class with some arguments something like this:

java my.package.MyClass abc hi 1 

Now, my project jar is built in the target directory of that project when I do mvn clean install. When I run that .bat file it gives me the below error

Error: Could not find or load main class my.package.MyClass 

Project's pom.xml only contains jars as dependency.

Do I need to do something in pom.xml to make it work?

1
  • Can you show your pom file and the folder layout you are using? And how the .bat file looks like? Commented May 30, 2014 at 9:29

1 Answer 1

6

please provide your pom.xml so we can look for it, anyway,

do you use maven-jar-plugin?

something like this

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>your.main.class.package.ClassName</mainClass> // your main class </manifest> </archive> </configuration> </plugin> 

and try to run your *.jar with command java -jar yourjar.jar

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.