Search code examples
windowsjavafxregistrywindows-security

This App Can't Run On Your PC, error when trying to run a JavaFX app from Right Click Menu option


Running Windows 11

I created a JavaFX Jar. The App/Jar works fine when you double click it, or even execute it from the command prompt.

To make it easier to use, I decided to add an option to my Right Click Options. Following the instruction from here: https://www.thewindowsclub.com/remove-click-context-menu-items-editors. I created a registry key:

Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\MyApp\command

This menu option shows up. But when I attempt to click on it. It gives me the error: "This App Can't Run On Your PC" Error Message

Again, the app runs fine if executed any other way. I even played around with the menu option to have it run other programs like the command prompt. Which works fine. I can use that menu option to open other programs. But when I try to run my jar file it throws that error. I'm thinking it's a security issue, but I don't want to go punching holes in my security settings.


Solution

  • I found a working solution. I created a batch file that calls the JAR. Then updated the registry key to run the batch file.

    Not as elegant as I had hoped and an extra step. But it works.