Creating a java executable

Discussion in 'Java' started by KNelson, Feb 19, 2007.

  1. KNelson

    KNelson Guest

    Hi, I would like to make a java executable. I am aware I need to jar
    it, I have the manifest file, and it will run when I type java -jar
    This.jar
    *** so I know the jar worked BUT, it will still not work when I double
    click it. That is what I want, I want to run it on the double click.
    jar cvfm This.jar manifest.mft This.class is what I am using to
    make the jar. When you respond to this, make sure you know your
    method works on the double click, because I can get the jar to run
    from the command line. THANK YOU any help would be appreciated
    Karl
    KNelson, Feb 19, 2007
    #1
    1. Advertising

  2. KNelson wrote:
    > Hi, I would like to make a java executable. I am aware I need to jar
    > it, I have the manifest file, and it will run when I type java -jar
    > This.jar
    > *** so I know the jar worked BUT, it will still not work when I double
    > click it. That is what I want, I want to run it on the double click.
    > jar cvfm This.jar manifest.mft This.class is what I am using to
    > make the jar. When you respond to this, make sure you know your
    > method works on the double click, because I can get the jar to run
    > from the command line. THANK YOU any help would be appreciated
    > Karl
    >


    Windows?

    --

    Knute Johnson
    email s/nospam/knute/
    Knute Johnson, Feb 19, 2007
    #2
    1. Advertising

  3. KNelson

    KNelson Guest

    On Feb 18, 8:55 pm, Knute Johnson <>
    wrote:
    > KNelson wrote:
    > > Hi, I would like to make a java executable. I am aware I need to jar
    > > it, I have the manifest file, and it will run when I type java -jar
    > > This.jar
    > > *** so I know the jar worked BUT, it will still not work when I double
    > > click it. That is what I want, I want to run it on the double click.
    > > jar cvfm This.jar manifest.mft This.class is what I am using to
    > > make the jar. When you respond to this, make sure you know your
    > > method works on the double click, because I can get the jar to run
    > > from the command line. THANK YOU any help would be appreciated
    > > Karl

    >
    > Windows?
    >
    > --
    >
    > Knute Johnson
    > email s/nospam/knute/


    Ok, let me make this clear, technically I do not want to make a
    executable, I just want be able to double click on the program to run
    it. So I know I need to jar it, but I would like to know the exact
    jar command.
    KNelson, Feb 19, 2007
    #3
  4. KNelson

    Phi Guest

    KNelson wrote:
    > Hi, I would like to make a java executable. I am aware I need to jar
    > it, I have the manifest file, and it will run when I type java -jar
    > This.jar
    > *** so I know the jar worked BUT, it will still not work when I double
    > click it. That is what I want, I want to run it on the double click.
    > jar cvfm This.jar manifest.mft This.class is what I am using to
    > make the jar. When you respond to this, make sure you know your
    > method works on the double click, because I can get the jar to run
    > from the command line. THANK YOU any help would be appreciated
    > Karl
    >


    Making JARs run at double click has nothing to do with java. This is a
    behaviour of your operating system.
    I use linux - gnome and use the following batch to start jar-files:

    runjar.sh
    > /usr/java/bin/java -jar $@


    The first jar-file I had to open with "right click -> properties ->
    open-with -> add; and I added the "runjar.sh" batch".
    I marked the runjar.sh as the preferred application to start. Since
    then, every jar file opens at double click.
    Phi, Feb 19, 2007
    #4
  5. KNelson

    KNelson Guest

    On Feb 18, 10:22 pm, Phi <> wrote:
    > KNelson wrote:
    > > Hi, I would like to make a java executable. I am aware I need to jar
    > > it, I have the manifest file, and it will run when I type java -jar
    > > This.jar
    > > *** so I know the jar worked BUT, it will still not work when I double
    > > click it. That is what I want, I want to run it on the double click.
    > > jar cvfm This.jar manifest.mft This.class is what I am using to
    > > make the jar. When you respond to this, make sure you know your
    > > method works on the double click, because I can get the jar to run
    > > from the command line. THANK YOU any help would be appreciated
    > > Karl

    >
    > Making JARs run at double click has nothing to do with java. This is a
    > behaviour of your operating system.
    > I use linux - gnome and use the following batch to start jar-files:
    >
    > runjar.sh
    >
    > > /usr/java/bin/java -jar $@

    >
    > The first jar-file I had to open with "right click -> properties ->
    > open-with -> add; and I added the "runjar.sh" batch".
    > I marked the runjar.sh as the preferred application to start. Since
    > then, every jar file opens at double click.


    yes, it does have to do with java. do your homework. thanks
    KNelson, Feb 19, 2007
    #5
  6. On Feb 19, 9:53 am, "KNelson" <> wrote:
    > Hi, I would like to make a java executable. I am aware I need to jar
    > it, I have the manifest file, and it will run when I type java -jar
    > This.jar
    > *** so I know the jar worked BUT, it will still not work when I double
    > click it. That is what I want, I want to run it on the double click.
    > jar cvfm This.jar manifest.mft This.class is what I am using to
    > make the jar. When you respond to this, make sure you know your
    > method works on the double click, because I can get the jar to run
    > from the command line. THANK YOU any help would be appreciated
    > Karl


    Hi,

    If u r using Windows...

    open a command prompt....going to Start --> Run --> cmd

    Enter the command: edit run.bat

    type as " java -jar <jar file name>" excluding the Quotes

    press Alt+f and s, and Alt+f +x

    Go to the location where the .bat file is created...double click , u
    can run the java application...this is the simplest way u can do it...

    Other wise...u need to have a webstart to support in any operation
    system..

    Check out this linkk....which will help u a lot on double click of ur
    app :)

    http://java.sun.com/docs/books/tutorial/deployment/webstart/index.html

    Regards
    Moin
    Proton Projects - Moin, Feb 19, 2007
    #6
  7. KNelson

    Ian Wilson Guest

    KNelson wrote:
    > Hi, I would like to make a java executable. I am aware I need to jar
    > it, I have the manifest file, and it will run when I type java -jar
    > This.jar
    > *** so I know the jar worked BUT, it will still not work when I double
    > click it. That is what I want, I want to run it on the double click.
    > jar cvfm This.jar manifest.mft This.class is what I am using to
    > make the jar. When you respond to this, make sure you know your
    > method works on the double click, because I can get the jar to run
    > from the command line. THANK YOU any help would be appreciated
    > Karl
    >


    You appear to be using Windows.

    When I installed JDK and Eclipse on Windows, the appropriate file
    associations were set up for me. I can double click a jar file (desktop
    icon or Windows Explorer) to launch the application it contains.

    http://support.microsoft.com/kb/307859

    http://support.microsoft.com/kb/323526
    Ian Wilson, Feb 19, 2007
    #7
  8. KNelson

    Ian Wilson Guest

    Ian Wilson wrote:
    > KNelson wrote:
    >
    >> Hi, I would like to make a java executable. I am aware I need to jar
    >> it, I have the manifest file, and it will run when I type java -jar
    >> This.jar
    >> *** so I know the jar worked BUT, it will still not work when I double
    >> click it. That is what I want, I want to run it on the double click.
    >> jar cvfm This.jar manifest.mft This.class is what I am using to
    >> make the jar. When you respond to this, make sure you know your
    >> method works on the double click, because I can get the jar to run
    >> from the command line. THANK YOU any help would be appreciated
    >> Karl
    >>

    >
    > You appear to be using Windows.
    >
    > When I installed JDK and Eclipse on Windows, the appropriate file
    > associations were set up for me. I can double click a jar file (desktop
    > icon or Windows Explorer) to launch the application it contains.
    >


    In case it's of any help ...

    C:\>assoc .jar
    ..jar=jarfile

    C:\>ftype jarfile
    jarfile="C:\Program Files\Java\jre1.5.0_10\bin\javaw.exe" -jar "%1" %*

    You can use assoc and ftype commands to create the above associations
    (substituting whatever is appropriate for your JRE).

    assoc /?
    ftype /?

    This question might have been more appropriate to comp.lang.java.help.
    So I have crossposted it there and set followups accordingly.
    Ian Wilson, Feb 19, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    13
    Views:
    12,215
  2. Replies:
    15
    Views:
    471
    Dave Thompson
    Aug 21, 2006
  3. pratap
    Replies:
    20
    Views:
    742
    Flash Gordon
    Mar 7, 2007
  4. Jason Cavett
    Replies:
    8
    Views:
    602
    Sanjay
    May 16, 2007
  5. Replies:
    0
    Views:
    423
Loading...

Share This Page