I have a class that I encoded in a standard java project in eclipse on OSX (Java 1.6). A class uses classes and interfaces from another library.
I select a class and then execute as> a Java application and everything works fine.
After that, I try to start the project as a Maven project, and everything starts to get a little upset. I will summarize all the steps here, hoping that someone will tell me what I am doing wrong: - From a standard Java project, I right-clicked and made the setting> Convert to Maven project and clicked Finnish. All is good so far.
Then create a path> Configure Build Path> and add the folder containing my project. Still good
Then I delete all @Override annotations, since I read SO somewhere that Maven uses JDK 1.5 instead of 1.6. Be that as it may, I delete them, and my red flags go away. At the moment, my class looks exactly the same as in the original java project (except for the deleted @override)
Then I make Maven> clean. I get success in building
THEN Maven> Install. I get build success
Then I select my class and run as> a Java application, and I get this ugly search trace:
Exception in thread "main" java.lang.NoClassDefFoundError: LMAXTrading / algos / HeartbeatClient Raised: java.lang.ClassNotFoundException: LMAXTrading.algos.HeartbeatClient at java.net.URLClassLoader $ 1.run2java.larclass .AccessController.doPrivileged (native method) on java.net.URLClassLoader.findClass (URLClassLoader.java:190) in java.lang.ClassLoader.loadClass (ClassLoader.java:306) at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher .java: 301) in java.lang.ClassLoader.loadClass (ClassLoader.java:247)
I donโt know where to go from here. You can imagine that I went through many trials and errors and searched in SO and elsewhere to find a way to make this work. But I just canโt understand whatโs wrong. Therefore, if anyone has an idea, I am so ready to listen.
I am pasting below my catalog layout from the Navigator view as well as from the package explorer view


And here is the POM.xml where I added the JRE configuration
<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>someproject</groupId> <artifactId>someproject</artifactId> <version>1.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> </project>
source share