Skip to content

[cli] Designer: Fix quotes in PMD_OPENJFX_MODULE_PATH setting - #6741

Merged
adangel merged 1 commit into
pmd:mainfrom
acanda:patch-1
Jun 18, 2026
Merged

adangel merged 1 commit into
pmd:mainfrom
acanda:patch-1

Conversation

@acanda

@acanda acanda commented May 31, 2026

Copy link
Copy Markdown
Contributor

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 designer would fail to start the designer with the error message java.lang.ClassNotFoundException: Files\Java\javafx-sdk-21.0.2.lib.

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

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`.
@pmd-actions-helper

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a Windows machine available to check, but don't you need to escape those?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_OPENJFX_MODULE_PATH:+--module-path "$PMD_OPENJFX_MODULE_PATH" --add-modules javafx.controls,javafx.fxml} \
)

@adangel adangel changed the title [designer] Fix quotes in PMD_OPENJFX_MODULE_PATH setting [cli] Designer: Fix quotes in PMD_OPENJFX_MODULE_PATH setting Jun 2, 2026
@adangel adangel added the a:bug PMD crashes or fails to analyse a file. label Jun 18, 2026

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

I've tested it under Windows and it works as expected.

@adangel adangel added this to the 7.26.0 milestone Jun 18, 2026
adangel added a commit that referenced this pull request Jun 18, 2026
@adangel
adangel merged commit c4f1dbc into pmd:main Jun 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a:bug PMD crashes or fails to analyse a file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants