In Java, How can I read file name from the context menu in Windows
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 con开发者_Python百科text 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!
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.
精彩评论