views:

32

answers:

2

I'm a Java developer, so please excuse my ignorance.

I want to create a shortcut to an executable, e.g., in the user's autostart or send-to folder (I don't want an installer to do that, because the installer usually is run by an administrator). What API (C preferred) I could use for that task (maybe using JNA)? Thanks in advance.

+1  A: 

It requires using COM, ShellLinkObject from shell32.dll. No idea what that takes in Java, but you'll find C# code in my answer in this thread.

Hans Passant
+1  A: 

As @Hans indicated, it requires COM (via ShellLinkObject or WScript.Shell). In Java you can call COM objects using a Java to COM bridge. There are a few available, ranging from free to commercial. A couple that I know of are:

Garett