-1

I build all my java projects with the command :

mvn spring-boot:run 

I'd like to know which jdk (and how) is used :

  • to build java project
  • to run java project

by spring-boot maven plugin ?

In fact, it seems that the jdk should not be the same for the build and the run.

How does it work ?

pringi
  • 3,987
  • 5
  • 35
  • 45
  • It uses the JDK that is currently configured in your environment for both operations. Check if this helps https://stackoverflow.com/questions/50249466/switch-between-multiple-java-versions-jdk1-8-and-jdk10 – pringi May 27 '22 at 09:22

1 Answers1

0

Do

java --version

in your command line. The result must be something like

openjdk 17 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

This JDK is used for build and run.

Tristate
  • 1,498
  • 2
  • 18
  • 38
  • i do not agree. In fact, $PATH and $JAVA_HOME could diverge regarding java binary path content (first match on jdk11 for $PATH, match on jdk8 for $JAVA_HOME). However, maven seems to use $JAVA_HOME when java command use $PATH. So, it seems you're not right. – it.drive.view May 27 '22 at 13:07