0

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.

JonR85
  • 700
  • 4
  • 12
  • Perhaps if you [make it an exe](https://stackoverflow.com/questions/69811401/how-to-create-a-standalone-exe-in-java-that-runs-without-an-installer-and-a-jr/69824145#69824145), or use jpackage to create an installer, it will run more reliably on other systems, and it will be easier to do what you want. – jewelsea Nov 27 '21 at 19:54

1 Answers1

1

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.

JonR85
  • 700
  • 4
  • 12