Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when launching Designer #72

Closed
armorcodehemant opened this issue Sep 1, 2023 · 3 comments · Fixed by #76
Closed

NPE when launching Designer #72

armorcodehemant opened this issue Sep 1, 2023 · 3 comments · Fixed by #76
Labels
bug Something isn't working
Milestone

Comments

@armorcodehemant
Copy link

armorcodehemant commented Sep 1, 2023

Describe the bug

./pmd designer
[main] INFO net.sourceforge.pmd.cli.commands.internal.AbstractPmdSubcommand - Log level is at INFO
java.lang.NullPointerException
	at java.util.Properties$LineReader.readLine(Properties.java:434)
	at java.util.Properties.load0(Properties.java:353)
	at java.util.Properties.load(Properties.java:341)
	at net.sourceforge.pmd.util.fxdesigner.DesignerStarter.getJavaFxVersion(DesignerStarter.java:116)
	at net.sourceforge.pmd.util.fxdesigner.DesignerStarter.isCompatibleJavaFxVersion(DesignerStarter.java:100)
	at net.sourceforge.pmd.util.fxdesigner.DesignerStarter.launchGui(DesignerStarter.java:153)
	at net.sourceforge.pmd.cli.commands.internal.DesignerCommand.execute(DesignerCommand.java:28)
	at net.sourceforge.pmd.cli.commands.internal.AbstractPmdSubcommand.call(AbstractPmdSubcommand.java:35)
	at net.sourceforge.pmd.cli.commands.internal.AbstractPmdSubcommand.call(AbstractPmdSubcommand.java:20)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at net.sourceforge.pmd.cli.PmdCli.main(PmdCli.java:18)

Version:
7.0.0-rc3

To Reproduce
Steps to reproduce the behavior:
run command "pmd designer"

Desktop:

  • Mac OS: 13.4 (22F66)
  • Java: java version : "1.8.0_291"
    Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
    Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

JavaFx:
javafx.runtime.version=8.0.291
javafx.runtime.build=b09

@armorcodehemant armorcodehemant added the bug Something isn't working label Sep 1, 2023
@adangel
Copy link
Member

adangel commented Sep 4, 2023

Thanks for the report. We are searching for "javafx.properties", but can't find it:

try (InputStream is = DesignerStarter.class.getClassLoader().getResourceAsStream("javafx.properties")) {

There are two problems here:

@adangel adangel changed the title NPE when launching Designer [cli] NPE when launching Designer Sep 4, 2023
@adangel
Copy link
Member

adangel commented Sep 4, 2023

To get it running for you, try to use a newer java version and openjfx. You need to set the env var JAVAFX_HOME then (see https://docs.pmd-code.org/latest/pmd_userdocs_extending_designer_reference.html).

Since you are using MacOS, you probably anyway need to use a newer javafx version... (#10, #49).

@adangel adangel added this to the 7.0.0 milestone Sep 4, 2023
@adangel adangel changed the title [cli] NPE when launching Designer NPE when launching Designer Sep 28, 2023
@adangel
Copy link
Member

adangel commented Sep 28, 2023

In summary: Oracle Java8 contains an embedded version of javafx - so our start script can't add the jre/lib or lib folder onto the classpath (and it shouldn't - we would try to modify the boot classpath). So, we need to live with the fact, that javafx.properties can't be found on the classpath. That means, we don't need to change the start script on PMD side.

But we can search this file in a different way - an this at least works for me under Linux (don't have a MacOS machine to test).

We basically look, from where the javafx classes have been loaded (protection domain, code source) and try to guess where the javafx.properties is.
See #76.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants