2

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 file 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?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user668943
  • 535
  • 1
  • 5
  • 8
  • *"I'm developing a Java desktop application that is to be used with Ubuntu."* What is the attraction of coding in Java when only targeting one OS? – Andrew Thompson Aug 06 '11 at 11:48
  • @Andrew Thompson: Because he knows Java better than anything else? Because Java is fast? Because he has no problem with people, running it on Solaris or Mac, but he has some definitive clients, which use Ubuntu? – user unknown Aug 06 '11 at 15:47
  • @user I'm not interested in lots of possibilities, but the one (or more) answers. – Andrew Thompson Aug 06 '11 at 16:01

2 Answers2

3

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.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

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.

Denis Tulskiy
  • 19,012
  • 6
  • 50
  • 68