it is possible to create a jar-file with some statement in it to define the startup class. doubleclickin the jar-file executes the specified class.
How its done precisely i can tell you tomorrow (about 10 hours after this post)
create the jar-file, with your classes in it. In the jar-file, create a folder called Meta-inf with a text-file in it named Manifest.mf
The file should contain the following information:
Well, a jar file isn't an executable - it cannot be run on it's own and most setups open it with winzip/winrar or not at all instead of running it (which requires a virtual machine installed, which isn't always the case either). A jar file is essentially a zip file with some extra internal structure-interpretation added.
but he wants to send some programs he wrote to his friends, he can make sure they have a virtual machine installed and the whole thing will work. no less, no more
Originally posted by liorean Well, a jar file isn't an executable -
Actually as far as packaging and starting up your Java application it is. Using a jar file is a common way of doing that. Not sure why you would argue about it.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Well, it's a good way of packaging a java application, but it can't be run on it's own, and is not by default run by a java virtual machine in win95 through win2k at least.
Besides, a file that can not be run natively in an OS without a parser, interpreter, compiler or virtual machine, is not an executable.
Originally posted by liorean Well, it's a good way of packaging a java application, but it can't be run on it's own
Nobody here was arguing that it couldn't be run on it's own. Of course it needs the JVM installed. That is what makes java so portable.
Quote:
Originally posted by liorean and is not by default run by a java virtual machine in win95 through win2k at least.
Last time I worked with jar files I seem to recall that you only needed to double click on the jar file to start up your application. And that was on several different versions of MS Windows. No file associations needed to be made. With the JDK installed the jar files will be run by the JVM.
Quote:
Originally posted by liorean Besides, a file that can not be run natively in an OS without a parser, interpreter, compiler or virtual machine, is not an executable.
How do you figure that? Did you make up that definition of what an executable file is yourself?
Besides all of that you seem to be missing the whole point of weronpc's question. He just wants his friends to be able to run an application he wrote in Java. He can package it up into a jar file and then just ensure his friends have the JVM installed and then all they need to do is double click the jar file.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!