Another newbie question...
I created a 'Hello Word' in Eclipse (writes to Console)...not a lot of effort involved obviously, but I noticed something...when you 'Run' it compiles and runs in Eclipse...no actual exe is created - I couldn't find anything that says 'compile to...'
So how do you actually compile this thing so I can run it outside of Eclipse? In Microsoft world when you (Debug/Run) it actually creates the exe and starts the exe with a debugger attached.
[461 byte] By [
bri189aa] at [2007-10-2 6:04:05]

> I created a 'Hello Word' in Eclipse (writes to
> Console)...not a lot of effort involved obviously,
> but I noticed something...when you 'Run' it compiles
> and runs in Eclipse...no actual exe is created - I
> couldn't find anything that says 'compile to...'
>
> So how do you actually compile this thing so I can
> run it outside of Eclipse? In Microsoft world when
> you (Debug/Run) it actually creates the exe and
> starts the exe with a debugger attached.
I'm still pretty wet behind the ears in Java too, so I'll like get corrected here big time, but...
Java is an interpreted language. It doesn't create .exe's when you compile, but makes .class files instead which the Java Virtual Machine (JVM) interprets at run time.
There is a thing called JAR files, which I've noted seem to behave like an .exe under Windows, but I haven't a clue how to create one nor what their actual nature is.
I've also heard of Just In Time (JIT) compilers for Java. Again, my ignorance reigns supreme!
Ya, ummm... dude, there isn't a way to make a Java executable to my knowledge. Every method I've ever used involved running it from the interpretter. Perhaps you could make a basic program that runs a batch program that sets a path to the interpretter and interprets it. You'd have to put the basic program, batch program, and class in the same folder though.
As mentioned earlier as well, Java is an interpreted language and the class files generated contain bytecode that gets executed on a jvm. As against exe files, class files are portable.
There are tools available that help make exe from java programs but not many actually use them.
About JAR files, they are just like any other tar balls.... or zip files if you are from windows - a compressed format to deliver java applications.
Jars are normally generated using the jar utility that comes with jdk and have a manifest file which can specify the entry point for the jar, thus, making the jar executible
Try doing the Java Tutorial on JAR files.
Get something like ANT that has instructions on how to write the 'build.xml' file
That'll mean you just have to type : ANT and you'll get your code compiled and in a JAR File
Then For Windoze make sure to set a File Association for JAR files.
{ part of the Java 1.5 install does this for you -- as long as you don't mind using the jre in C:program files / blah/ blah................ }
Then you can just double click on your jar files and they work jsut 'like a bought one'
> Jars are normally generated using the jar utility> that comes with jdk and have a manifest file which> can specify the entry point for the jar, thus, making> the jar executibleYou still need to have the JVM installed on your machine though, right?
> > Jars are normally generated using the jar utility
> > that comes with jdk and have a manifest file which
> > can specify the entry point for the jar, thus,
> making
> > the jar executible
>
> You still need to have the JVM installed on your
> machine though, right?
yes, definitely
> > > Jars are normally generated using the jar
> utility
> > > that comes with jdk and have a manifest file
> which
> > > can specify the entry point for the jar, thus,
> > making
> > > the jar executible
> >
> > You still need to have the JVM installed on your
> > machine though, right?
>
> yes, definitely
Hmm. That's where I get the feeling (I wish I had C++). I've been writing a program to analyze lottery results and predict winners. (I know, pointless from a statistical point of view - but great programming practice). Thing is, a few family members are interested in the program, but they aren't computer-savvy. I'm concerned about their ability to download, install, and setup a JVM. And they are scattered across the country; I can't exactly "pop over" and do this for them.
...An .exe would be so much easier from this perspective *sigh*.
> ...An .exe would be so much easier from this perspective *sigh*.
Check out [url=http://www.izforge.com/izpack/]IzPack[/url]: it can build an
installer for you that also installs a Java Runtime Environment for you.
The user just needs to click and the entire shebang will be installed.
kind regards,
Jos
JosAHa at 2007-7-16 13:04:30 >

> > ...An .exe would be so much easier from this
> perspective *sigh*.
>
> Check out
> [url=http://www.izforge.com/izpack/]IzPack[/url]: it
> can build an
> installer for you that also installs a Java Runtime
> Environment for you.
> The user just needs to click and the entire shebang
> will be installed.
Unfortunately, "It produces lightweight installers that can be run on any operating system where a Java virtual machine is available." That quote from the site you provided suggests to me that the person I send something to still has to have the JVM already installed.
Sure could be useful once that hurdle is cleared though. Thanks for the reference.
> Unfortunately, "It produces lightweight installers that can be run on
> any operating system where a Java virtual machine is available."
> That quote from the site you provided suggests to me that the person I
> send something to still has to have the JVM already installed.
You should've read a bit further on that page: they also have a 'native'
installer that first installs a JVM for you if it isn't present on the target
machine yet.
kind regards,
Jos
JosAHa at 2007-7-16 13:04:30 >

I've played around with these
[url]http://jsmooth.sourceforge.net/[/url]
[url]http://www.ej-technologies.com/products/install4j/overview.html[/url]
[url]http://www.gammadyne.com/seau.htm[/url]
I didn't like all the unnecessary crud that install4j puts on the target machine.
JSmooth ends up being too large for what it's worth.
I ended up buying a license for SEAU, and it makes for a pretty clean install.
I just wanted something simple and small that would be a quick download for clients.
IzPack looks pretty good so i'll check it out. I've bundled the jre with some
of my apps before but never really distributed those versions, I figure most
of the time they should be able to deal with it.
by the way, thanks for the info!
I was wanting to try something else.
kind regards
Walker
> IzPack looks pretty good so i'll check it out. I've bundled the jre with
> some of my apps before but never really distributed those versions, I
> figure most of the time they should be able to deal with it.
>
> by the way, thanks for the info! I was wanting to try something else.
You're welcome. I use IzPack all the time; I don't use their native
installer though: there's a mention about the necessity of a JVM in
my readme files and a link to Sun's site where they can get one.
The IzPack manual is a bit chaotic IMHO, but after a bit of digging and
rereading (and cannibalizing their pack.xml file) I was up and running
in no time ;-)
kind regards,
Jos
JosAHa at 2007-7-16 13:04:30 >
