Add Java program to Windows' context menu

时间:2015-09-01 22:35:34

标签: java windows shell contextmenu

I'm trying to make a Windows' shell extension to add a program shortcut in the context menu of a certain file type. I've got it working for a random application, but the problem comes when I try to make it execute a java program.

I'm putting this as command:

java -jar "Path\To\MyJar.jar" %1

But when I click on the context menu item, it opens the "Open with" window. It also happens using java "Path\To\MyClass.class" %1.

Aren't those types of commands a valid input for the command key? Is there any other alternative? (besides of using an .exe wrapper like with Launch4j).

Thanks!

EDIT: Actually, using this as command:

"myBat.bat" %1

where "myBat" only executes the java command given before, is able to execute the program. But unfortunately, %1 only passes the path until it finds a space, so this alternative can't be used.

0 个答案:

没有答案