Current Position:Home > Drag and Drop Onto a JAR

Drag and Drop Onto a JAR

Update:10-11Source: network consolidation
Advertisement
I got a great answer from Dr. Clap (for XP) to this question in June.
However, it doesn't work in NT 4.0. I am looking for a workaround for this OS.
I have an application that runs out of a JAR file (an editor). I would like to be able to drag and drop a (html) file onto a desktop shortcut for to the jar, and have: 1) javaw run, 2) pass it the jar file to open, and 3) pass the html file to the opened jar for editing.
What follows below is how to do this in XP (and it works). In NT, if I put this into the shortcut it tells me - when I drag and drop a file onto it - that it can't find the appropriate classes.
================================================================
Look at the association for the JAR extension, you'll find that it uses javaw.exe and the "open" action is mapped to some command line involving javaw.exe and %1 which represents the jar file to be executed. Now, for your extension make a very similar setup, only your "open" command line will look something like this:
"C:\...\javaw.exe" -jar YourSpecialJar.jar "%1" %*
That command line runs your jar file and passes the file being "opened" to the command line as the first parameter. (I don't know what the %* does but it's in the command line for the jar extension.)

The Best Answer

Advertisement
I would doubt that it would work differently under NT. I'd assume you just didn't do it right, or this jar's manifest file doesn't include the right jars that it depends upon.