从Java创建快捷方式链接(.lnk)
我正在用Java编写安装程序(启动程序),并且需要能够在此过程中在用户桌面上创建快捷方式。
我对任何想法感兴趣是最好的方法。 我考虑的一个选项是在Windows上使用VB脚本并使用本机’shortcut.exe’为我做,但是第三方文件实用程序将是首选。
/** * Create an Internet shortcut * @param name name of the shortcut * @param where location of the shortcut * @param target URL * @param icon URL (ex. http://www.server.com/favicon.ico) * @throws IOException */ public static void createInternetShortcut (String name, String where, String target, String icon) throws IOException { FileWriter fw = new FileWriter(where); fw.write("[InternetShortcut]\n"); fw.write("URL=" + target + "\n"); if (!icon.equals("")) { fw.write("IconFile=" + icon + "\n"); } fw.flush(); fw.close(); }
完整示例: 创建Internet快捷方式(Windows)
看到这个类似的问题。 而且这个 。
快速谷歌搜索后,我找到了这个java库: http : //alumnus.caltech.edu/~jimmc/jshortcut/
- 如何更改JAX-WS Web服务的地址位置
- 使用all(jComboBox,JTextField,jFileChooser)作为表编辑器会覆盖引用
- 如何在基于NetBeans的项目中将javaDoc添加到我的Java代码中?
- 我得到一个“线程中的exception”主“java.lang.NoClassDefFoundError:org / openqa / selenium / WebDriver”
- 实体是否默认缓存在jpa中?
- JPanel定位不正确
- 删除文件的扩展名
- Java – 无论JRE版本如何,都可以找到正在使用的tzdata版本
- 如何通过java连接ms访问以及如何在windows7平台上配置odbc驱动程序