简体   繁体   中英

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" 错误信息

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM