I will add an item on a context menu, called "Open with ABC". This context menu appear when I right-clicked a folder.

When the "Open with ABC" is selected, it will launch a Java program, "abc.class".

That Java program need "directory path" of that chosen folder, as argument.

How my Bash script will look like?

Informations you might need:

  • java: usr/bin/java
  • abc Java program: home/john/myapp/abc.class
  • The script will be put inside home/john/.config/caja/scripts
  • The john is my username for Linux Mint MATE 17.2, with caja as file manager

Below questions might close to my problem:

  • Do you only need to know the command to run the java program or are you asking for the complete solution? I don't know how to get the argument but for run the java program you can use "java -jar /home/john/myapp/abc.jar argument"
    – migrc
    Oct 19, 2015 at 9:03
  • I know about that Java thingy., in fact, it's not about Java - but how to make the OS, run a program, in a way that I want, with all requirements supplied.
    – mshahrim
    Oct 19, 2015 at 9:32

2 Answers 2


There is Caja-actions Configration tool to add the open with ABC in context menu.

There is command tab in Caja Action tool, there you can provide the script path and the directory argument. Here is a image of the tool http://poundbangbinbash.com/LinuxMint/MATE/Caja/CajaActions/ConfigurationTool.png

your script would look like

usr/bin/java [options] home/john/myapp/abc.class $*
  • Thanks. This is close to my problem. I tried the script, but still failed. I'm on my best effort to use and modify your solution. I will inform any progress if necessary.
    – mshahrim
    Oct 20, 2015 at 2:21
  • Can you add snaps of failure and script.May i can help.
    – pranav
    Oct 20, 2015 at 11:23
  • But first, I think we should go into chat, there's a lot I want to ask - do you prefer email, or any medium?
    – mshahrim
    Oct 20, 2015 at 11:40
  • I almost forgot, how to I launch "Caja Actions Configuration Tool"? I have no idea where to get it.
    – mshahrim
    Oct 20, 2015 at 11:47
  • You'll find Caja-Actions Configuration Tool under System -> Preferences.
    – pranav
    Oct 20, 2015 at 15:17

My Bash script looks like this:



Since my program was placed inside here:


  • I must always use -cp java options to locate my "abc" program first.
  • The $HOME represents my home directory, /home/john,
  • The $CAJA_SCRIPT_SELECTED_FILE_PATHS environment variable represents the path of the folder I selected, which eventually being passed as argument to "abc" program.

Note that these solution is made in caja specific environment - no guarantee to work in elsewhere.

Credits to @pranav, thanks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .