How Do You Troubleshoot a pom.xml File?

Problem scenario
You are trying to run your Java program from a .jar file. You get an error like this:

Error: Could not find or load main class target.contint-0.1.0.jar
Caused by: java.lang.ClassNotFoundException: target.contint-0.1.0.jar

What should you do?

Examine the mainClass stanza. The word to the left of the period should be the name of the package. You should have a .java program that will have a line such as package foobar. If the name is "foobar", then your pom.xml file's mainClass stanza should have a stanza such as this:


Leave a comment

Your email address will not be published. Required fields are marked *