创建桌面快捷方式 [英] Create Desktop shortcut
本文介绍了创建桌面快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在研究一个java应用程序。
I am working on a java application.
我想创建应用程序的Exe文件的桌面快捷方式。
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();
}
}
你可以从这里
这篇关于创建桌面快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文