PDA

View Full Version : Java excutable


weronpc
08-31-2003, 06:33 AM
Hello everyone,

I had been working with Java for 4 months,

Do anyone know how to make java file (*.class) into an excutable file?

I want to send some program I wrote to my friends..

Thank you all...

Roelf
09-01-2003, 09:16 PM
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)

liorean
09-01-2003, 09:20 PM
Well, you can search the web for a Java-->native executable compiler. I believe most are commersial and might cost a little, however.

Roelf
09-02-2003, 07:52 AM
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:

Main-Class: path.to.your.main.class.which.will.be.executed

success with it

liorean
09-02-2003, 04:54 PM
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.

Roelf
09-03-2003, 07:56 AM
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

Spookster
09-03-2003, 02:17 PM
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.

liorean
09-03-2003, 05:01 PM
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.

Spookster
09-03-2003, 06:26 PM
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.

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.


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.