Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

how to create .exe file in java?

Thread view: 
ashwinijain - 01 Jan 2007 11:47 GMT
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..
Flo 'Irian' Schaetz - 01 Jan 2007 12:01 GMT
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
ashwinijain - 01 Jan 2007 12:08 GMT
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.
Andrew Thompson - 01 Jan 2007 12:34 GMT
> 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.
Flo 'Irian' Schaetz - 01 Jan 2007 13:06 GMT
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
Andrew Thompson - 01 Jan 2007 15:16 GMT
> 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 - 01 Jan 2007 17:28 GMT
> > 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.
Thomas Kellerer - 01 Jan 2007 14:02 GMT
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/
Jhair Tocancipa Triana - 01 Jan 2007 16:41 GMT
> 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.

Signature

-- Jhair

Knute Johnson - 01 Jan 2007 17:27 GMT
> 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?

Signature

Knute Johnson
email s/nospam/knute/

Stefan Schmiedl - 01 Jan 2007 18:10 GMT
>> In case of b): Forget it, simply add a Java
>> Runtime Environment to your project.
[quoted text clipped - 3 lines]
> 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.
Knute Johnson - 01 Jan 2007 19:01 GMT
>>> In case of b): Forget it, simply add a Java
>>> Runtime Environment to your project.
[quoted text clipped - 11 lines]
>   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
[quoted text clipped - 13 lines]
>
> 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.

Signature

Knute Johnson
email s/nospam/knute/

Thomas Kellerer - 01 Jan 2007 19:06 GMT
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
[quoted text clipped - 5 lines]
> 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/
Stefan Schmiedl - 02 Jan 2007 15:54 GMT
>>>> In case of b): Forget it, simply add a Java
>>>> Runtime Environment to your project.
[quoted text clipped - 13 lines]
>
> 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.
Thomas Kellerer - 02 Jan 2007 16:28 GMT
>> 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
Stefan Schmiedl - 02 Jan 2007 16:35 GMT
>  >> Now the users other java stuff doesn't work correctly.
>
[quoted text clipped - 10 lines]
> 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.
Chris - 01 Jan 2007 18:37 GMT
> 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..

http://mindprod.com/jgloss/nativecompiler.html


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.