getting the file path name dropped on the application icon

Posted on 2003-11-04
Last Modified: 2010-03-31
I want to create an application which is represented as an icon on the desktop and the user could drag files and drop them on the top of the icon and thus the application should be able to get the file path name and store it in a text file. Please help I have no idea how to start. I am using java and Windows xp platform.
Question by:ibaj1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 92

Accepted Solution

objects earned 63 total points
ID: 9683286

Author Comment

ID: 9683392
I don't want the application to opene when the file is dragged to the icon and also  don't want to use swing libraries, it is just a simple application that gets the files names dragged to pleeeeeeeeease
LVL 20

Assisted Solution

Venabili earned 62 total points
ID: 9683608
I do not think it is possible. The build in DND in java is with the Swing classes

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 92

Expert Comment

ID: 9683665
> also  don't want to use swing libraries

then you can't use dnd with Java.
You need a Swing component to drop the file onto.

If you just want to drop the file onto a Windows icon then it's not a Java problem, you need to write a Windows application.

Author Comment

ID: 9683772
How would I write a Windows application? Is there any tutorials? I need as much help as I could
LVL 92

Expert Comment

ID: 9683820

Expert Comment

ID: 9684259
>How would I write a Windows application? Is there any tutorials? I >need as much help as I could

u mean AWT application....
LVL 92

Expert Comment

ID: 9684268
You can't do it with AWT.
And an applet is certainly not suitable.

Expert Comment

ID: 9685017
And I don't think that is possible with just an icon sitting on the desktop.  The icons are short-cuts to program executables, interacting with it tells the OS to start the associated program.  It *might* work if you have your main method accept the first parameter as being the file name, and *hope* that is what is sent to the program when it is activated.  Then have it run some code (no need for a gui since you only want to append that name to a file), and then exit.  Give it a try, I'm sure that you already have some code in mind.  You will need to ensure that the javaw.exe is associated with the jar file in the OS, then print out the command-line arguments your receive (if any) in your main.  

If it doesn't work then research the theme "Active Desktop".  Or like Objects said write a Windows program.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb stateless example 2 69
ejb wildfly example 2 113
Facing this issue for maven proxy setting 2 45
Java List 4 76
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question