Exporting .JAR to Windows .EXE using Eclipse and Jsmooth

Hey experts,

I'm trying to make an .EXE from some .Java classes I wrote as well as external .jars that are added in the classpath.  I'm new to Java so I'm not sure how the dependencies work when you export a .jar file....  Will it run on its own assuming you have Java installed on your machine?

Utlimately I want this .exe to have no dependcies on other files, so I think that means I have to bundle JVM with my program... I think Jsmooth can do that  but I have no idea how any of this stuff goes together really.  Help!

-Chris
LVL 1
DiscomonkeyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
You're probably better off using Webstart (as JSmooth mention, with provisos)
DiscomonkeyAuthor Commented:
I need an .exe standalone app, so webstart isn't an option for me...
JavatmCommented:
This is what you need:
http://www.excelsior-usa.com/jet.html
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

CEHJCommented:
>> I need an .exe standalone app

There are really only two ways to do this:

a. (rare) compile the app into native code (possible with non-gui low java version)
b. (usual) combine the app into an exe that includes the VM and Java libraries

Taking the normal route (b) buys you so little (nothing getting installed) that it may not really be worth it
CEHJCommented:
The following is instructive:

http://www.yoda.arachsys.com/java/javaexe.html
CEHJCommented:
This is also of interest, but be aware that the author works for Excelsior:

http://www.javalobby.org/articles/java2exe/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DiscomonkeyAuthor Commented:
CEHJ,

I need option b) b/c the program I am using must be 100% independent.  I do not know how to bundle the VM and Java libraries into an .exe, although that Excelsior program is AWESOME I still do not fully understand what I'm missing.  The program seems to create an .exe that has everything EXCEPT the VM.  I think Step 2 is supposed to package your .exe with the VM, but it wants to make either an installer or a cd image.  All I want is an .exe with a lightweight VM, how do I do it?
DiscomonkeyAuthor Commented:
I really don't need a step by step process.  I know how the .jars get wrapped into an .exe that calls some JRE.... but I have not been successful on finding a lightweight JRE that I can bundle with my program.  Do i simply include an unpacked JRE with my program and have my 3rd party software point to it?  or do I need a special .exe (for windows gui, javaw.exe) to make it work?
CEHJCommented:
>>a lightweight JRE that I can bundle with my program.

What do you mean by 'lightweight' and what resources does your app need? You won't get much more lightweight than running with the lowest possible JRE
CEHJCommented:
While i'm waiting for your answer, here's another:

http://www.ej-technologies.com/buy/exe4j/single.php
DiscomonkeyAuthor Commented:
Sorry for the slow replies.

By lightweight I mean the final package can be reasonably downloaded and used.  a JRE that is 15 megs will make my app like 16 megs, vs a 2meg one which will be 3 megs.  I don't know what the difference in sizes mean really, like do I need a large JRE to make my app work?  What are the diffferences between the JRE's??

Here's the only place I've found where you can get these packages:

http://www.installshield.com/downloads/default.asp?pm=mpf&pver=all&language=English&mt=jvm&loc=N&intpage=2&mode=submit&platform=&gv=1

JVM's available for download, which is the same thing as JRE, but no idea what the difference between all of them is, or if its even what I need.
DiscomonkeyAuthor Commented:
I got it.  Thanks for helping me out CEHJ, the links helped guide me alot to the the answer I was seeking, which was that with a java 2 software download there is a directory

\j2sdk1.4.2_08\jre\javaws

that is what you need to bundle if you use Jsmooth and pick the option bundle JVM and include this directory with your distrubtion, should work great.

Thanks again!
DiscomonkeyAuthor Commented:
actually that didnt' work, on my friends computer.  Oh well.
CEHJCommented:
:-)


>>that is what you need to bundle if you use Jsmooth

'this' is Java WebStart (my original suggestion ;-)), which probably goes towards demonstrating my point that these products don't really add much value in the end ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.