This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes launching GUI through an icon Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "launching GUI through an icon" Watch "launching GUI through an icon" New topic
Author

launching GUI through an icon

Bhargo Dev Arya
Greenhorn

Joined: Jun 29, 2011
Posts: 8

Hi everyone...

I have created a swings application in JAVA
I want this application to be launched by clicking on an icon.
Now any java program should work where ever we have the JRE and the JDK, so how can I create an icon so that when I click on the icon the GUI comes on screen in windows os?
Is creating a jar an answer to this...if yes then please explain how?if not then please tell me how it can be done...


regards
bhargo
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3989
    
  18

Just create an executable Jar, and create a shortcut to your Jar. You can set an image for your shortcut.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2270
    
    3

Just to complement what my good buddy Stephan just said, in your executable JAR file, you'll have to indicate the Main-Class in your MANIFEST.MF file (the Main-Class is the fully-qualified name of the class that has the main method, that is, the class that launches your application).

You can find more about the MANIFEST.MF file here and more about the jar command here.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: launching GUI through an icon
 
jQuery in Action, 3rd edition