Java 23 - Convert JAR to EXE
Using Launch4Java to convert a JAR file into an EXE
Closed Caption:
everybody's Brian today we'll be
discussing converting jar files in the
Exies why would you want to convert a
jar file in the first place it's already
been converted
well let's say you want to hand this off
to your friend and they don't really
understand command lines or jars or job
or anything they just wanted to run well
in Windows you have any exceed you want
to double click it and run it now doing
a simple search for java THC shows a
huge list of things and a lot of these
costs money today we'll be looking for
one of my personal favorites called
launch for java and you see its launch
for j dot sourceforge.net then you go to
the site and just download i've already
downloaded it but I'm just kind of
showing you the website where you can
kind of expect just click download now
and this is a cross-platform compiler
meaning it can go on just about any
operating system now I've already
created HR file and this is the jar
we're going to work with now this jar
file just is simply prints out a hello
from java here's lunch for java i'm
using three-point 01
it's a zip file just extract it and then
going to the folders you see a lot of
these things really what you need to
know is that it comes in jar format and
exe they believe they actually created
the CXC using launch for J so yes this
is a java program this is just an
example of what java programs can do so
double click Launch 4j and it comes up
with this big let's look at window
we're going to go over some of these
things here all these tabs are different
different variables you need to set
going to go over real quickly so output
file this is what you're building what
you want to make and call it test . sexy
and the jar file you want to use theirs
are wind test . jar and you have the
option of don't wrap the jar launch only
um what are they talking about here well
basically what you're doing is you're
taking the jar file and wrapping it
inside of an exe so the user never sees
the jar file you have the option of not
doing that and just make an exe that
calls the jar file you can specify a
manifest an icon change the directory
get command line arguments that the
process priority
you can do a lot of different things
we're not going to really go over these
we're just gonna keep it basic for this
tutorial class path i don't recommend
you mess around with us
this is if you want to override the
classpath header this is something we
should talk about header type you're
actually compiling something here these
are profiles or object files meaning
you're actually calling a compiler in
the background and generating an exe
this is a GUI or console we have a
console what you're looking at here is a
GUI when we run our java programs in a
console so we're going to select console
don't worry about single instance now
Jerry if we tried to just compile this
right now notice how it says specified
know Jerry version
you can't just type 1 point out because
it wants a specific format should be X .
X 2 X so it's looking for you know one .
0.0 that's the minimum Jerry don't want
you can set environmental variables a
splash screen version information and
different messages the user will see
we're just going to stick with the basic
settings for this tutorial
go ahead and make a pile now it's gonna
want you to save it i've already done it
now you notice down at the bottom here
it says compiler resources linking
wrapping what does all this mean
well it creates the resources out of the
jar file links it all together and then
wrapped into an exe and then it creates
are exe in this case test dot exe so we
go back here now we suddenly have test
dot exe and you run that well window
popped up and disappeared so fast you
couldn't really see it so we're going to
just copy CD paste there and you see
there's our test dot exe so only type
test
hello from java so you can you know just
perfect concept here you can actually
delete these and see that just test dot
exe is there and when you run it it runs
fine now you will know you will need to
have your end-user have a Java Runtime
environment installed you can't just
hand them the XC expected to run they
have to have java installed so that's
something to note this is brian and
today we covered a converting a jar file
into an exe hope you found this video
educational and entertaining thanks
Video Length: 05:09
Uploaded By: VoidRealms
Published: 10/14/2010
View Count: 127,652