I have Java Spring app that can be launched with
./mvnw spring-boot:run
I want to debug this app, so I'm trying to launch it with flags
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-XDebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
And get error:
Unrecognized option: -XDebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
But when I'm trying to run same app with flags "XDebug" and "Xrunjdwp" separately:
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-XDebug"
./mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
It launches without any errors.
Why I get error when trying to use both flags in same time? My obvious guess is that by some reason Java treats "-XDebug -Xrunjdwp" as one flag, but I don't see what is the reason of this.
-XDebug and -Xrunjdw are older debugging options that have been replaced since the days of Java 6. Unless you are stuck using Java 5 since 2006 you should be using the modern debug arguments: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
.