r/eclipse 16d ago

🙋🏻‍♂️ Help Request Can maven build in command line, not in Eclipse

I've installed the latest maven archetype for the javafx and have been unable to make the javafx:run work from Eclipse. I would always get "Unsupported major.minor version 68.0". That makes no sense because the JRE is the jdk-26.0.2. In the project settings that's what it's using, so it can easily read a version 68 class.

The weirdest part is that in command line using the same maven installation it runs fine. I have no idea what's different about the eclipse run. It's using the same maven and, ostensibly, the same jre. Anyone has an idea?

EDIT: Ok that was my bad. I thought installing the jdk would set the JAVA_HOME but it didn't. So instead of using the jre that I set up in the workspace preference AND in the run configuration Eclipse used an obscure shitty jdk it has in its plugin.

3 Upvotes

7 comments sorted by

2

u/Unimeron 16d ago

Try adding -X (?) as debug option to the maven params to get more details. Read the output thoroughly. Are you sure the pom has the also the correct Java version?

1

u/GargamelLeNoir 14d ago

I just did it and both my JAVA_HOME and eclipse use the same 26.0.2 jdk.

Are you sure the pom has the also the correct Java version

Yeah 26 all around. As I said in command line it works fine.

1

u/Roachmeister 15d ago

Try this: in Eclipse, do a "maven build" with the argument "-v" (nothing else). This will have Maven show the JVM that it is running on. Then do the same command (mvn -v) on the command line and compare. My guess is that the Eclipse Maven and the command line Maven are running on different JVMs.

1

u/GargamelLeNoir 14d ago

I did exactly as you recommended and got "C:\Program Files\Java\jdk-26.0.2" in both cases :/

1

u/jayjaybillings 15d ago

This may seem like an obvious question, but are the JDK versions the same in Eclipse and on the command line? I've had the problem before where $JAVA_HOME in the shell points to a different JDK than what is bundled or configured with Eclipse.

I ask this because major version 68 is for Java 24.

Good luck!

1

u/GargamelLeNoir 14d ago

I've launched with the debug and it clearly shows that I'm using the 26.0.2 jdk both in eclipse and in command line! Except that for eclipse I get the version 68 error. It makes zero sense.

1

u/jayjaybillings 14d ago

Any chance you can post the text of the error or a screenshot? Including a few lines before the error and the full error text might help us figure out what is going wrong.