1,105,214 Community Members

How to create shortcut to windows application (*.ink) in Java?

Member Avatar
GökhanBarış
Newbie Poster
10 posts since Jul 2009
Reputation Points: 3 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi everyone,

I used to create shortcuts with IWshRuntimeLibrary in C#, but now i am trying to create in java, which i couldn't found via googling.

Can anyone show me the shortcut path of wisdom and illumination? :)

Member Avatar
JamesCherrill
... trying to help
10,364 posts since Apr 2008
Reputation Points: 2,081 [?]
Q&As Helped to Solve: 1,749 [?]
Skill Endorsements: 47 [?]
Moderator
Featured
 
0
 

Use the ProcessBuilder class to run the (free) XXMKLINK program?

Member Avatar
GökhanBarış
Newbie Poster
10 posts since Jul 2009
Reputation Points: 3 [?]
Q&As Helped to Solve: 2 [?]
Skill Endorsements: 0 [?]
 
0
 

Use the ProcessBuilder class to run the (free) XXMKLINK program?

Thanks James,

Even though, i don't want to use an external executable file to process, i guess this is the best alternative for now (with running in quiet mode "/q")...

Member Avatar
kac_ani
Newbie Poster
1 post since Aug 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi everyone,

I used to create shortcuts with IWshRuntimeLibrary in C#, but now i am trying to create in java, which i couldn't found via googling.

Can anyone show me the shortcut path of wisdom and illumination? :)

Please look at http://www.ttechnika.xt.pl/programowanie/67-windows-shortcut-fileslnk-in-java-en.html for working code.

Member Avatar
necman
Newbie Poster
1 post since May 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

try this

String script = "Set sh = CreateObject(\"WScript.Shell\")"
+ "\nSet shortcut = sh.CreateShortcut(\"D:/temp/Shortcut.lnk\")"
+ "\nshortcut.TargetPath = \"D:/some path to file\""
+ "\nshortcut.Save";

File file = new File("d:/temp/temp.vbs");
FileOutputStream fo = new FileOutputStream(file);
fo.write(script.getBytes());
fo.close();
//Runtime.getRuntime().exec("wscript.exe D:/temp/crear-acceso-directo.vbs");
Runtime.getRuntime().exec("wscript.exe " + file.getAbsolutePath() );

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article