I am working on a java application.
I want to create desktop shortcut of my application's Exe file.
Is is possible to do it from my application itself ? Or user has to do it manually by right clicking ?
package farzi;
import net.jimmc.jshortcut.JShellLink;
public class Sc {
JShellLink link;
String filePath;
public Sc() {
try {
link = new JShellLink();
filePath = JShellLink.getDirectory("")
+ "C:\\Program Files\\Internet Explorer\\iexplore.exe";
} catch (Exception e) {
}
}
public void createDesktopShortcut() {
try {
link.setFolder(JShellLink.getDirectory("desktop"));
link.setName("ie");
link.setPath(filePath);
link.save();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String a[]) {
Sc sc = new Sc();
sc.createDesktopShortcut();
}
}
you can get the jar from here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With