usualy I run java app ( I create by my self)
by click it's jar file.
How to run it via click an icon on desktop
( how to link between icon and the jar file

thank you
denny

Recommended Answers

All 4 Replies

On windows you can create a shortcut to the .jar file and copy that to your desktop.

or, if you reeeaaally want to prove you're a hardcore coder, you can write a second app, put that in a jar, place that on your desktop and call your first app with that.
off course it's very inefficiƫnt, you'll have to change your code each time you move your original application to another folder, ...

but now I am wondering ... did you really not think about shortcuts before NormR1 suggested it? I mean, just right-clicking on your application and select 'Copy to desktop' is all it takes.

how about you take this vb script which will create a shortcut on your desktop edit it as needed :

Set objShell = CreateObject("WScript.Shell")
strPath = Shell.SpecialFolders("Desktop")
Set objLink = objShell.CreateShortcut(strPath & "\test.lnk")
objLink.Arguments = """1 2 3"""
objLink.Description = "This Launches Notepad"
objLink.HotKey = "CTRL+ALT+SHIFT+X"
objLink.IconLocation = "Notepad.exe,0"
objLink.TargetPath = "C:\Windows\Notepad.exe"
objLink.WindowStyle = 3
objLink.WorkingDirectory = "C:\Windows"
objLink.Save

make you java application write this to a file with the exetension *.vbs and the execute it using

try
{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("filename.vbs");
}

catch(Exception e)
{
System.err.println("Could not create shortcut, error: "+e.getMessgae());
}

and a shortcut to you application will be made :)

hi NormRI,stultuske,and cOrRuPtG3n3tx

thank you for your answer

denny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.