Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: Java excutable

  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Canada, Ontario, Mississauga
    Posts
    312
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Java excutable

    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...

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    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)
    I am the luckiest man in the world

  • #3
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, you can search the web for a Java-->native executable compiler. I believe most are commersial and might cost a little, however.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    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
    I am the luckiest man in the world

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    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
    I am the luckiest man in the world

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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

  • #8
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #9
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •