Results 1 to 5 of 5
  1. #1
    Rose88 is offline Member
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    0

    Lightbulb run java application from desktop with double click

    Hey,
    The problem is:
    I wrote a java application that displays a GUI and do some task
    I want to run my program from the desktop just with a double click on an icon

    Can anybody help me with that?!

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Package it into a jar. A jar can be executed by the JVM directly.

    Netbeans and i assume eclipse will package them for you when you build your project or you can do it by hand.

    You can double click on it or have a shortcut to it or run it from the command line:

    Java Code:
    java -jar MyApplication.jar

  3. #3
    Rose88 is offline Member
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    0

    Default

    MyApplication is the main class right?

  4. #4
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Whatever the name of your project/application is. It may or may not be the name of the main class, or the class where your main is, hehe. :)

  5. #5
    marrow is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Default

    If you have a simple app in a single .class file this batch script may be useful:
    (for GUI apps it's not pretty because of the command prompt)

    @echo off
    pushd %~dp1
    java %~n1
    popd
    pause

Similar Threads

  1. Run Jar file on double click
    By dhaval.rajput.p in forum New To Java
    Replies: 2
    Last Post: 07-24-2009, 06:44 PM
  2. How to detect double click with a JFrame
    By Jary316 in forum New To Java
    Replies: 3
    Last Post: 01-05-2009, 09:39 PM
  3. Double click radio button
    By mandragora in forum AWT / Swing
    Replies: 11
    Last Post: 11-10-2008, 12:06 PM
  4. Problem running a java desktop application
    By chris@gaiag.net in forum AWT / Swing
    Replies: 2
    Last Post: 08-24-2008, 05:24 AM
  5. Installer for Java desktop application
    By nitingupta183 in forum SWT / JFace
    Replies: 0
    Last Post: 03-18-2008, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •