views:

77

answers:

2

We have an existing java desktop application which starts, when user click on our application icon (placed on desktop) OR double click on executable(.exe). It opens the frame which allows user to select the file from native file system and uploads it to the server.

Now we would like to facilitate user, that he can pick a file from windows explorer and drag it to the "shortcut / Application icon" & drop it on the "shortcut / Application icon" on the desktop. This would start the uploading of that file on the server.

we need to capture the action of "drop" and launch on shortcut.. which may be completely not related to java, it can be very generic to any application.

We are using JSmooth to build an executable from jar and NSIS for installer purpose. I would like to know..

How we can launch the application if user drops local file onto the system icon ? How we get the absolute path of file name which has been dropped onto the executable ?

A: 

Dragging and dropping a file onto a executable (or a shortcut to an executable) will result in Windows passing the file name along to the executable as the first command line parameter. If the file name contains spaces, then the file name will be quoted.

You can then retrieve this file name from the args parameter passed to your main method and do what you need to do from there.

I suspect that Linux and OS X will behave in a similar fashion.

X-Cubed
A: 

Thanks for help.. I would like to know how can we boot our Java Archive (JAR) file, similar like executable? We have a command line application and we provide JAR to user on MAC and LINUX O.S. Thus we need to create self executable JAR and some how we can pass absolute path of file name which has been dropped onto that JAR.

So in case of JAR : -

How can we create self executable JAR ?
How we can launch the Application if user drops local file onto the JAR ? How we get the absolute path of file name which has been dropped onto the JAR ?