Repository navigation
[cli] Designer: Fix quotes in PMD_OPENJFX_MODULE_PATH setting - #6741
Conversation
If JAVAFX_HOME contains a path with spaces, e.g. `C:\Program Files\Java\javafx-sdk-21.0.2`, the command `.\pmd.bat designer` would fail to start the designer with the error message `java.lang.ClassNotFoundException: Files\Java\javafx-sdk-21.0.2.lib`.
|
Compared to main: (comment created at 2026-05-31 20:57:09+00:00 for c941b7f) |
| ) | ||
|
|
||
| SET "PMD_OPENJFX_MODULE_PATH=--module-path %JAVAFX_HOME%/lib --add-modules javafx.controls,javafx.fxml" | ||
| SET "PMD_OPENJFX_MODULE_PATH=--module-path "%JAVAFX_HOME%/lib" --add-modules javafx.controls,javafx.fxml" |
There was a problem hiding this comment.
I don't have a Windows machine available to check, but don't you need to escape those?
There was a problem hiding this comment.
You might think so, but you'd be wrong :-).
SET only allows a handful of special characters to be escaped and the quotes are not one of them. Something like ^"%JAVAFX_HOME%^" won't work (the ^ is the escape character).
The documentation of SET states that the quotes on the right-hand side of the = become part of the variable's value.
I don't know much about Windows batch scripts or their quoting logic but "%JAVAFX_HOME%/lib" is the only way I could find to make it work, and all the examples I found use the same 'quotes inside quotes' notation.
There was a problem hiding this comment.
The change is probably correct. On https://ss64.com/nt/set.html (section "Values with Spaces - using Double Quotes") there are some more examples.
Since we have both the module path and the --add-modules parameter here, we can't add the quotes later on in line 31 (as we do for CLASSPATH).
Note, that the bash version works a little bit different here, add the --add-modules parameter later (
pmd/pmd-dist/src/main/resources/scripts/pmd
Line 255 in 8a740a4
adangel
left a comment
There was a problem hiding this comment.
Thanks for the fix!
I've tested it under Windows and it works as expected.
Describe the PR
If JAVAFX_HOME contains a path with spaces, e.g.
C:\Program Files\Java\javafx-sdk-21.0.2, the command.\pmd.bat designerwould fail to start the designer with the error messagejava.lang.ClassNotFoundException: Files\Java\javafx-sdk-21.0.2.lib.Ready?
./mvnw clean verifypasses (checked automatically by github actions)