how to create .exe file in java?

Discussion in 'Java' started by ashwinijain, Jan 1, 2007.

  1. ashwinijain

    ashwinijain Guest

    I have develpoed billing software with 10 classes.
    Now I want to create .exe of this project.
    so, help me in creating .exe of my project..
     
    ashwinijain, Jan 1, 2007
    #1
    1. Advertising

  2. And thus spoke ashwinijain...

    > I have develpoed billing software with 10 classes.
    > Now I want to create .exe of this project.
    > so, help me in creating .exe of my project..


    In many cases, this question only shows that you want to do something
    you normaly shouldn't do. But of course, there can be good reasons for
    that. The question is: Do you want to...

    a) Simply make it easier to "execute" your software, so that you
    customer doesn't need to type a long text in the command line?

    b) Allow your program to be started without having Java installed?

    c) Something else?

    In case of a), you should read more about the concept of executable .jar
    files or write a batch file. In case of b): Forget it, simply add a Java
    Runtime Environment to your project. If c): Tell us, why you want to do
    that?

    Btw: (If I got it right) JBuilder has a feature to make a .exe "wrapper"
    for your program, but this is imho nonsense, it justs makes ther file
    bigger. You still need an installed Java - and if you have an installed
    Java, you can easily execute the .jar itself...

    Flo
     
    Flo 'Irian' Schaetz, Jan 1, 2007
    #2
    1. Advertising

  3. ashwinijain

    ashwinijain Guest

    I want to create executable file for first reason
    a) Simply make it easier to "execute" your software, so that you
    customer doesn't need to type a long text in the command line?
    I just want one logo on my desktop so when user double click it, my
    software should start running.
     
    ashwinijain, Jan 1, 2007
    #3
  4. ashwinijain wrote:
    > I want to create executable file for first reason
    > a) Simply make it easier to "execute" your software, so that you
    > customer doesn't need to type a long text in the command line?
    > I just want one logo on my desktop so when user double click it, my
    > software should start running.


    Web-start. Works on Win/Mac/Linux/Unix, and can
    offer the user a desktop icon (&/or menu item).

    Other points in it's favor.
    - Auto updating
    - Supported by Sun
    - Ensures correct JRE versioning

    Andrew T.
     
    Andrew Thompson, Jan 1, 2007
    #4
  5. And thus spoke Andrew Thompson...

    > Web-start. Works on Win/Mac/Linux/Unix, and can
    > offer the user a desktop icon (&/or menu item).


    Isn't that a little bit "to much"? Wouldn't be a simply executable .jar
    and a suitable link with the correct item on the desktop be enough?

    Flo
     
    Flo 'Irian' Schaetz, Jan 1, 2007
    #5
  6. ashwinijain wrote on 01.01.2007 13:08:
    > I want to create executable file for first reason
    > a) Simply make it easier to "execute" your software, so that you
    > customer doesn't need to type a long text in the command line?
    > I just want one logo on my desktop so when user double click it, my
    > software should start running.
    >

    http://launch4j.sourceforge.net/
     
    Thomas Kellerer, Jan 1, 2007
    #6
  7. Flo 'Irian' Schaetz wrote:
    > And thus spoke Andrew Thompson...
    >
    > > Web-start. Works on Win/Mac/Linux/Unix, and can
    > > offer the user a desktop icon (&/or menu item).

    >
    > Isn't that a little bit "to much"?


    What? The menu item going too far for you?

    >...Wouldn't be a simply executable .jar
    > and a suitable link with the correct item on the desktop be enough?


    For the end user? Sure.

    'Too much' effort?

    With web-start, the end-user clicks a link,
    the desktop icon gets created (if they say
    'OK' when asked). Could not be easier.

    Andrew T.
     
    Andrew Thompson, Jan 1, 2007
    #7
  8. ashwinijain writes:

    > I want to create executable file for first reason
    > a) Simply make it easier to "execute" your software, so that you
    > customer doesn't need to type a long text in the command line?


    You can write a script which launches your application (launches it
    with the java tool).

    Are you saying you want to build an executable not for performance
    reasons but to avoid a user to write a "long text" in the command
    line? That doesn't make sense to me.

    --
    -- Jhair
     
    Jhair Tocancipa Triana, Jan 1, 2007
    #8
  9. Flo 'Irian' Schaetz wrote:
    > In case of b): Forget it, simply add a Java
    > Runtime Environment to your project.


    Florian:

    Do you know how to actually do that? Distribute your application with a
    runtime environment that you don't have to install?

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 1, 2007
    #9
  10. Andrew Thompson wrote:
    > Flo 'Irian' Schaetz wrote:
    > > And thus spoke Andrew Thompson...
    > >
    > > > Web-start. Works on Win/Mac/Linux/Unix, and can
    > > > offer the user a desktop icon (&/or menu item).

    > >
    > > Isn't that a little bit "to much"?


    Or.. try it yourself. Here linked is a launch file for
    a space simulator (imaginitively titled WotsItsName
    while I haggle with the author over the title).

    It is sandboxed, and around 150 Kb.

    <http://www.1point1c.org/spacesim/sim/app.html#download>

    Besides desktop shortcut & menu item, it prompts
    for file types/associations (for very obscure file types).

    Andrew T.
     
    Andrew Thompson, Jan 1, 2007
    #10
  11. On Mon, 01 Jan 2007 09:27:57 -0800, Knute Johnson wrote:

    > Flo 'Irian' Schaetz wrote:
    >> In case of b): Forget it, simply add a Java
    >> Runtime Environment to your project.

    >
    > Florian:
    >
    > Do you know how to actually do that? Distribute your application with a
    > runtime environment that you don't have to install?
    >


    Assuming your application is packaged in an executable jar file

    app.jar

    you can just copy over your jre folder so that you have

    app.jar
    jre_1.x.y_z

    Now you need to make sure that your jar is run with the local jre,
    so you could do something like

    SET JAVA_HOME=jre_1.x.y_z
    %JAVA_HOME%\bin\javaw.exe -jar app.jar

    and you're done:

    app.jar
    jre_1.x.y_z
    start.bat

    As an additional gimmick, pick your favorite win32-exe-generating
    tool and emulate the batch commands with it. You might end up with
    a 10 kB starter, a 1 MB jar, and 40 MB jre to distribute.

    s.
     
    Stefan Schmiedl, Jan 1, 2007
    #11
  12. ashwinijain

    Chris Guest

    Chris, Jan 1, 2007
    #12
  13. Stefan Schmiedl wrote:
    > On Mon, 01 Jan 2007 09:27:57 -0800, Knute Johnson wrote:
    >
    >> Flo 'Irian' Schaetz wrote:
    >>> In case of b): Forget it, simply add a Java
    >>> Runtime Environment to your project.

    >> Florian:
    >>
    >> Do you know how to actually do that? Distribute your application with a
    >> runtime environment that you don't have to install?
    >>

    >
    > Assuming your application is packaged in an executable jar file
    >
    > app.jar
    >
    > you can just copy over your jre folder so that you have
    >
    > app.jar
    > jre_1.x.y_z


    Now the users other java stuff doesn't work correctly.

    >
    > Now you need to make sure that your jar is run with the local jre,
    > so you could do something like
    >
    > SET JAVA_HOME=jre_1.x.y_z
    > %JAVA_HOME%\bin\javaw.exe -jar app.jar
    >
    > and you're done:
    >
    > app.jar
    > jre_1.x.y_z
    > start.bat
    >
    > As an additional gimmick, pick your favorite win32-exe-generating
    > tool and emulate the batch commands with it. You might end up with
    > a 10 kB starter, a 1 MB jar, and 40 MB jre to distribute.
    >
    > s.


    It would be really nice to be able to hand somebody a CD with your app
    and a JRE, have them stick it in their computer and get it to work. As
    good as Sun has been about making minimal changes, each JRE has issues
    with the others. I have to install updates and new software for clients
    at multiple sites. To be able to just copy files and run the program
    would solve my biggest operational problems. My software needs JAF,
    Java Mail and Java Comm APIs as well. To be able to distribute a ready
    to go system instead of installing all of the pieces and parts would be
    really nice.

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 1, 2007
    #13
  14. Knute Johnson wrote on 01.01.2007 20:01:
    > It would be really nice to be able to hand somebody a CD with your app
    > and a JRE, have them stick it in their computer and get it to work. As
    > good as Sun has been about making minimal changes, each JRE has issues
    > with the others. I have to install updates and new software for clients
    > at multiple sites. To be able to just copy files and run the program
    > would solve my biggest operational problems. My software needs JAF,
    > Java Mail and Java Comm APIs as well. To be able to distribute a ready
    > to go system instead of installing all of the pieces and parts would be
    > really nice.
    >

    Have a look at the link I posted:

    http://launch4j.sourceforge.net/
     
    Thomas Kellerer, Jan 1, 2007
    #14
  15. On Mon, 01 Jan 2007 11:01:33 -0800, Knute Johnson wrote:

    > Stefan Schmiedl wrote:
    >> On Mon, 01 Jan 2007 09:27:57 -0800, Knute Johnson wrote:
    >>
    >>> Flo 'Irian' Schaetz wrote:
    >>>> In case of b): Forget it, simply add a Java
    >>>> Runtime Environment to your project.
    >>> Florian:
    >>>
    >>> Do you know how to actually do that? Distribute your application with a
    >>> runtime environment that you don't have to install?
    >>>

    >>
    >> Assuming your application is packaged in an executable jar file
    >>
    >> app.jar
    >>
    >> you can just copy over your jre folder so that you have
    >>
    >> app.jar
    >> jre_1.x.y_z

    >
    > Now the users other java stuff doesn't work correctly.


    It will work just as it did before. I've done no installation with
    global effects, I've just copied a folder. The java.exe in there
    will not be used unless you explicitly call it.

    >
    > It would be really nice to be able to hand somebody a CD with your app
    > and a JRE, have them stick it in their computer and get it to work.


    I did it with an USB stick, but it was just that: stick, click, run (from
    stick). If I didn't have to save some data, a CD would have worked just
    as well.

    > My software needs JAF,
    > Java Mail and Java Comm APIs as well. To be able to distribute a ready
    > to go system instead of installing all of the pieces and parts would be
    > really nice.
    >


    I don't know if those things would require a more elaborate procedure,
    but assuming that redistributing them is legally ok, it's probably just
    a matter of placing them where your runtime can find them. Having not done
    this, I could be wrong, however.

    s.
     
    Stefan Schmiedl, Jan 2, 2007
    #15
  16. On 02.01.2007 16:54 Stefan Schmiedl wrote:
    >> Now the users other java stuff doesn't work correctly.


    > It will work just as it did before. I've done no installation with
    > global effects, I've just copied a folder. The java.exe in there
    > will not be used unless you explicitly call it.


    Depends on how you changed the variable JAVA_HOME. If you set it in the
    batch file, it will only affect the process started by the batch file.
    To be sure to avoid side-effects, you should use setlocal inside the
    batch file, so the SET will only have an effect during the runtime of
    the batch file. This would be important if the user started your batch
    file from within an already open command shell. Without setlocal, any
    process started from within that shell but after your batch file ran,
    will inherit the new setting for JAVA_HOME

    Thomas
     
    Thomas Kellerer, Jan 2, 2007
    #16
  17. On Tue, 02 Jan 2007 17:28:26 +0100, Thomas Kellerer wrote:

    > On 02.01.2007 16:54 Stefan Schmiedl wrote:
    > >> Now the users other java stuff doesn't work correctly.

    >
    >> It will work just as it did before. I've done no installation with
    >> global effects, I've just copied a folder. The java.exe in there
    >> will not be used unless you explicitly call it.

    >
    > Depends on how you changed the variable JAVA_HOME. If you set it in the
    > batch file, it will only affect the process started by the batch file.
    > To be sure to avoid side-effects, you should use setlocal inside the
    > batch file, so the SET will only have an effect during the runtime of
    > the batch file. This would be important if the user started your batch
    > file from within an already open command shell. Without setlocal, any
    > process started from within that shell but after your batch file ran,
    > will inherit the new setting for JAVA_HOME


    You're right there ... I knew there was another reason for using
    minuscule exe wrappers instead of batch files.

    s.
     
    Stefan Schmiedl, Jan 2, 2007
    #17
    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. Namratha Shah \(Nasha\)
    Replies:
    0
    Views:
    4,796
    Namratha Shah \(Nasha\)
    Nov 5, 2004
  2. adam
    Replies:
    1
    Views:
    373
    Anfrew Thompson
    Feb 26, 2004
  3. Gulapala

    To create an EXE file in Java

    Gulapala, Oct 21, 2004, in forum: Java
    Replies:
    5
    Views:
    2,070
    Michael Saunby
    Oct 23, 2004
  4. davidb
    Replies:
    2
    Views:
    1,084
    davidb
    Aug 30, 2006
  5. daved170

    run exe and create exe

    daved170, Oct 11, 2009, in forum: Python
    Replies:
    3
    Views:
    490
    Benjamin Kaplan
    Oct 11, 2009
Loading...

Share This Page