开发者

Add Java program to Ubuntu context menu

开发者 https://www.devze.com 2023-03-26 13:26 出处:网络
I\'m developing a Java desktop application that is to be used with Ubuntu.I need to add a context menu item which appears when the user right clicks on a fi开发者_JS百科le and to pass the fully qualif

I'm developing a Java desktop application that is to be used with Ubuntu. I need to add a context menu item which appears when the user right clicks on a fi开发者_JS百科le and to pass the fully qualified file path as an argument to the program.

After searching I found I can use Nautilus-Actions but I want to distribute my software. Therefore, it should be a shell script or installation option.

How do I achieve that?


Deploy the app. using Java Web Start and register an interest in the types of files the app. can process (e.g. .txt, .rtf, .html) using an association element in the JNLP (app. launch) file.

For an example of using file associations in a JWS app., see the file service demo. of my JNLP API demos.


You can use nautilus-actions from command line and script:

 man nautilus-actions-new

However, this requires for this package to be installed (I'm using Ubuntu Oneiric Alpha and this package was not installed), which can only be acheived by packing your program as a deb archive.

Other possibility is Nautilus Scripts which does not require any packages. But it will place your menu item in a submenu.

Programs like nautilus-open-terminal add stuff to the nautilus menu without any dependencies, you might want to checkout its source.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号