Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2e-users] java.lang.ClassNotFoundException with java9 and maven

Hello all,

I'm testing eclipse (oxygen 1a RC2 linux 64) and java 9 (oracle linux 64 release) and I'm encountering this issue. I have a maven project targeting java 8 with a simple pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.datarouter</groupId>
<artifactId>j9mvn</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
with a simple class at src/main/java/j9mvn/Main.java
package j9mvn;
public class Main{
public static void main(String[] args){
System.out.println("Hello world");
}
}
I imported the project in eclipse (File->Import...->Existing Maven Projects). When trying to run the main in eclipse I get:
Error: Could not find or load main class j9mvn.Main
Caused by: java.lang.ClassNotFoundException: j9mvn.Main
 
Eclipse project configuration looks ok: build path contains src/main/java as source folder and java 8 as library.
I see the class correctly generated at target/classes/j9mvn/Main.class

Any idea how to solve this issue?

Back to the top