Be sure to explain the environment such as what IDE are you using.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
by putting your project into a (valid) .jar file. you can do this by using the functionality of your IDE, but you don't need an IDE to create one. winrar (or a similar program) will do just fine.
stultuske
Industrious Poster
4,372 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
The Java SDK has the jar command that will create a jar file.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
if it is an application your IDE may provide an export as executable jar file option (I know eclipse does), or you can use a program called Java Launcher, which converts your applications into exes.
If it is an applet then you cannot convert it into an exe.
sirlink99
Practically a Master Poster
690 posts since Oct 2010
Reputation Points: 58
Solved Threads: 19
Skill Endorsements: 2
do not, I repeat NOT go and create an .exe file unless you have no other option.
if your employer demands an .exe file, and threatens to fire you, now this might be a reason I can understand (although you could also look at him with an "you kiddin' me?" expression on your face).
another reason I could understand, is that you have to develop a piece of code that you have to run under Windows in a certain (spooky?) way which only accept an .exe file.
but unless you're in such a situation, don't go there. a .jar file already is an executable, which can run by command line, or by being 'clicked', just like an exe file.
the main difference is, if you "settle" for a .jar file, you don't limit the users of your code to a particular (Windows) operating system. and this is not mentioning that a lot of 'create exe' apps out there create those exe's based on (who would have guessed?) a .jar file. so, since you'll already have the .jar file, you might as well stick with it :)
stultuske
Industrious Poster
4,372 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
Like stultuske said,
if your employer demands an .exe file, and threatens to fire you, now this might be a reason I can understand
You can also use this tool: http://launch4j.sourceforge.net/
What it does is essentially change the extension and make it run correctly.
Even when my employer says "Make it an EXE file" I say "Why? A jar does the same thing"
turt2live
Junior Poster in Training
90 posts since Jan 2011
Reputation Points: 15
Solved Threads: 3
Skill Endorsements: 0