tags:

views:

32

answers:

2

I am making an installer in java swing it almost completed only one thing is left to do that is to create desktop shortcut of our software.I do not want to copy software on desktop but I want to create instance of that software like other MS software. How it can be done please help me. I am already copied my software in c:/Program files by using copy directory and I want to create shortcut on desktop .

A: 

A Windows shortcut is just a .LNK file in the desktop directory. You need to find out the .lnk structure and then you can build such a file from (pure) Java.

Alternative: Use JNI to call the appropriate Windows API.

EDIT: If you want to be lazy, you can create one "template" .lnk file by hand and store it as a resource in your program's Jar; then, for a different abc.exe program name, just copy that file to the desktop directory with the desired link file name, and change the name of the executable inside the file. Hopefully the .exe file name will be at a fixed offset, and hopefully you can control the length of that name to be constant. Then it should be easy.

Carl Smotricz
A: 

Shortcut to Create shortcuts ;-)


Here's the windows file-format for shortcuts (.lnk files)

http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html

Simply Create a file with the appropriate fields ans save it to disk as:

UrProgName.lnk

Thats it. You are done...

GoodLUCK!!

CVS-2600Hertz