V4Vendetta
V4Vendetta

Reputation: 1

How to run a JAR file through an icon on Java Desktop Application Using Swing?

I want to execute a jar file (BORG Calendar) from an icon in a desktop application using java swing (JinternalFrame, JDesktoppane,...) But I dont know how?

Upvotes: 0

Views: 2844

Answers (3)

Andrew Thompson
Andrew Thompson

Reputation: 168825

Java Web Start can suggest desktop icons & menu items for a application. I would recommend doing both, since from memory some OS' will disallow one or the other.

Alternately, JWS can leave the choice to the user, with the assistance of the javax.jnlp.IntegrationService.

JWS is available for platforms that run Java, and is supported by Oracle.

Upvotes: 3

Radi
Radi

Reputation: 6584

you need to export your program as jar , then use a program like Lunch4j if you want to make a shortcut to your jar .

Upvotes: 0

javing
javing

Reputation: 12423

If you want to run your app using an icon in the desktop you have to export it as an executable jar file.

Here a tutorial how can you do it from the command line: http://viralpatel.net/blogs/2008/12/create-jar-file-in-java-eclipse.html

I suppose that you use an IDE for your programming, so you should have somewhere the option export as executable jar.

This is how i do it in eclipse: enter image description here

Then find the jar file with the play icon. enter image description here

I think that is all you need. You can optionally click on next and configure some more options. Note: Maybe your app uses external libraries or images that also should be added, dont forget about them.

Upvotes: 1

Related Questions