How can I create a shortcut to launch an external application?
881879Oct 5 2011 — edited Oct 7 2011Hello, I'm developing app in Swing where I want to create a shortcut for any external application, I'm able to get the .exe path, and an icon path (in .png format), is there a way to create a "shortcut" or button and assign the icon and the .exe path to run it? This is what I have to get the .exe path:
Process p = Runtime.getRuntime().exec("\"" + jTextField2.getText() + "\"");
Where jTextField takes the value from a JFileChooser value, doing the same for the icon, then I could do this for a button to assign the icon:
ImageIcon img1 = new ImageIcon("C:\\image.png");
jButton7.setSize(64, 64);
jButton7.setIcon(img1);
But I havent' found any way to make the button (or any kind of shortcut) to execute the program, I could go and create a method to do it on click or ActionPerformed, but the idea is to do all this when I finish the create the shortcut, I hope you can understand me, I'm kinda confused, so far, I can launch the app but I want to create a new button/shortcut everytime I need to add an external app, thanks in advanced!!!