Forums Register Login

Shortcut to a .jar

+Pie Number of slices to send: Send
Hello. I am writing a little program to create an installer of an application I wrote, and I want to create a shortcut in windows to access through the start menu. I know that it has to be possible from java, because programs like izpack create the shorcut i am trying to do.

Could someone, please help me or give me some advice???

Thanks a lot!!!
+Pie Number of slices to send: Send
If the .jar is executable and has all its classpaths in the manifest file, and the file association with java/javaw is set up in the Windows registry, you can usually execute a .jar file on Windows by double-clicking it.
+Pie Number of slices to send: Send
Hello Campbell Ritchie. Thanks for answering. I had a little mistake writing my question, because what i want is to create the shortcut with the installer and I don't want the user to do the right click steps... just when the installer has finished, the user should be able to access my jar through the start menu.

Thanks again
[ July 25, 2008: Message edited by: Jessid Leon Velez Gutierrez ]
+Pie Number of slices to send: Send
A short cut is I believe just another file, so if you knew the format of this file you might be able to create one using Java. Without knowing the format you would probably need to use a Windows API to create it and that would require the use of JNI.
If you look at the Izpack website, you will see that all the Windows specific features (creating shortcuts, registry entries, ect) are optional features, which means they most likely supply an exe or dll that they access using JNI.
+Pie Number of slices to send: Send
 

the user should be able to access my jar through the start menu.



The contents of the Start|Programs menu on Windows XP comes from several folders.

One of them on my system is:
C:\Documents and Settings\Owner\Start Menu\Programs\
Other versions have different locations that may be pointed to by an Environment variable.

To allow a user to start your program from the Start|Programs menu, I guess you'd have to add a folder in the above path and create a shortcut in that folder.
+Pie Number of slices to send: Send
Hello Norm. Exactlry what you said about creating a shortcut in that folder is what i want to do, but with java....how to create a shortcut???

Or if exists a command to run from de command line, that would be another help, because i could create a batch file and execute it using java

Thanks a lot!
+Pie Number of slices to send: Send
 

how to create a shortcut???


Don't have a clue. It would depend on the OS.
Windows might have a utility to do it, or perhaps thru a JNI program or as someone suggested, look at an existing shortcut and create one on your own.
+Pie Number of slices to send: Send
 

Originally posted by Norm Radder:

Don't have a clue. It would depend on the OS.
Windows might have a utility to do it, or perhaps thru a JNI program or as someone suggested, look at an existing shortcut and create one on your own.


I've tried investigating the .lnk format once before but it's quite hard. I have written some JNI code though that can do it, but it's a bit complex. You have to work with C interfaces - and that's not as easy as Java interfaces.

The trick is to use IShellLink and IPersistFile; this link has a small example which I used to get my code running.
+Pie Number of slices to send: Send
Hello Rob. Thanks for answering. You are right when you say that is not easy to write a .Ink file. I also found what each byte means, bun dont know how to create them. I havent seen the link you tolme, but i will let you know when i do it.

Again: thanks a lot

See you!
+Pie Number of slices to send: Send
Rob, npi with the link you suggested.
npi: ni puta idea


After a long time asking in irc channels, i had the good idea to ask in #C channel and they suggested to ask in #winapi channel... do not enter there. Not a pleasant experience...

jejeje
Get out of my mind! Look! A tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3060 times.
Similar Threads
WSAD 5.1.2 shortcut keys
creating shortcut in windows OS - Urgent
shortcut for program
Creating desktop shortcut from Java program
Shortcut Keys
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:13:50.