I created the source code for a very simple Java program in Eclipse.
Then I ran mvn install to build the program, which worked fine.
The following are the errors I am getting when I try to run the program built
by Maven from the command line. I have included the command prompt errors; the
source code and the POM file. I have also searched extensively for both of the
execution time errors I am encountering but have been unable to find any
explanation that works, and I've tried several.
Attempt(s) to execute the class file:
H:\EclipseWorkspacesLunaForMaven\SimpleNoLibraryProject\target\classes\main\java\org\prog>java
SimpleNoLibraryProgram
Error: Could not find or load main class SimpleNoLibraryProgram
H:\EclipseWorkspacesLunaForMaven\SimpleNoLibraryProject\target\classes\main\java\org\prog>java
main.java..org.prog.SimpleNoLibraryProgram
Error: Could not find or load main class
main.java..org.prog.SimpleNoLibraryProgram
Attempt to execute the JAR file:
C:\Users\Michael CTR
Tarullo.FAA\.m2\program-build-repository\main\java\org\prog\SimpleNoLibraryProgram\1.0>java
-jar SimpleNoLibraryProgram-1.0.jar
no main manifest attribute, in SimpleNoLibraryProgram-1.0.jar
Source code:
package main.java.org.prog;
public class SimpleNoLibraryProgram
{
public static void main(String[] args)
{
System.out.println("Hello Simple No Library
Program!!!");
}
}
POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>main.java.org.prog</groupId>
<artifactId>SimpleNoLibraryProgram</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>SimpleNoLibraryProgram</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Michael Tarullo
Contractor (Engility Corp)
Enterprise Architect
NSRR System Administrator
FAA WJH Technical Center
(609)485-5294