• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Creating desktop shortcut from Java program

 
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am really hoping someone knows how to do this, because I have no clue. From my Java app, I am creating a .bat file and putting it on the desktop. This batch file is for starting another Java app. What I would like to do is actually make this file a shortcut (from the Java app, not by right clicking it) so that it will no longer have to have the .bat extension, but it can be anything. Also, it would be nice if I can associate an image with this shortcut (also doing this from the Java app) Does anyone know how to do this or know where I could find this information? Thanks a lot!!!

Barry
P.S. I am working on NT machine.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
create a shortcut
search for your bat file
rename the shortcut....
click on properties to set your picture

it is not a java question i think.....
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You totally ignored what I had in parenthesis. I know how to do that. There should be a way to do this from within a Java app. How do you think Oracle, Microsoft, IBM, Napster, or anybody else place a shortcut on your desktop? It is done within their code. There has to be a way from my Java code. Does anyone have any suggestions? Many thanks!!!

Barry
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would need to use native code for that. It won't work from pure Java code, since shortcuts aren't like regular files.
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure how to make a shortcut file in Java. I feel that this has a native code and JNI solution.
But if you know that the executable file is in the path, create a batch file with the just the name of the file and move it to desktop directory. In this case the image that you are going to see will be the one for notepad's.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic