views:

12

answers:

1

Hi Evrybody. I'm new here and in Java programing I'm trying to write program that cath the context menu command and read the file name and his full path

for example when I'm clicking (right mouse) on some file and getting the context menu and I selecting any option (copy, or send to, or open with) I want that my program will read the file name and his full path.

for now I just have a form with text box , no code yet.

I want to know how should I start or if some one have Idea or code to help me with that

Thanx alot!

+1  A: 

It's quite simple:

In your program, the main method has to be of this kind:

public static void main(String[] args) { ... }

In Eclipse, you can export this as a runnable jar. Now, open the sendto menu via

shell:sendto

in your explorer window. In there, put a shortcut. The shortcut you are looking for is

java -jar C:\path\to\jar\main.jar

Be aware that you have to be able to run your application for that.

When you do that, the sendto-filename will appear in the args parameters in your program.

private_meta
Thanx, but I didn't understand how to get the main.jar ,and what code should I write to get the file name