How do i convert Java .class fine into .exe file!

Discussion in 'Java' started by G, Nov 16, 2008.

  1. G

    G Guest

    I know people are getting tired of answering it, and i've been
    searching the web for hours, but i still don't get it! I need to
    convert my .class file into native windows machine executable (.exe)
    that does not require JRE. How do I do it? Does the java JDK include a
    file that converts it into .exe? Thanks
    G, Nov 16, 2008
    #1
    1. Advertising

  2. G

    Arne Vajhøj Guest

    > I know people are getting tired of answering it, and i've been
    > searching the web for hours, but i still don't get it! I need to
    > convert my .class file into native windows machine executable (.exe)
    > that does not require JRE. How do I do it? Does the java JDK include a
    > file that converts it into .exe?


    The simple answer is that you don't !

    You create an executable jar, let your users install JRE and
    then they doubleclick on your jar and it runs.

    There are various third party solution like Jet Excelsior
    etc., but they are not widely used in the Java world.

    Arne
    Last edited by a moderator: Jan 23, 2010
    Arne Vajhøj, Nov 16, 2008
    #2
    1. Advertising

  3. G

    Lew Guest

    >> I know people are getting tired of answering it, and i've [sic] been
    >> searching the web for hours, but i [sic] still don't get it! I need to
    >> convert my .class file into native windows machine executable (.exe)
    >> that does not require JRE. How do I do it? Does the java [sic] JDK include a
    >> file that converts it into .exe?


    Arne Vajhøj wrote:
    > The simple answer is that you don't !
    >
    > You create an executable jar, let your users install JRE and
    > then they doubleclick on your jar and it runs.
    >
    > There are various third party solution like Jet Excelsior
    > etc., but they are not widely used in the Java world.


    To expound, if you need an .exe, don't use Java. It is not uncommon for
    Windows machines to have Java installed, and not hard to get it installed when
    you distribute Java programs, so the actual benefit of "executablization" of
    Java programs is, at best, very questionable.

    AIUI, so-called "solutions" to this so-called "problem" consist of bundling
    the JRE inside the .exe itself, hardly an elegant solution. Since version
    6u10, Java has gotten more clever about minimizing its footprint for the
    average program, so there's really no good reason to do this anyway.

    You have to download Flash to run .swf files, Word or an associated reader or
    OpenOffice to read .doc files, Media Player or equivalent for .mpg, etc. What
    is the big deal about downloading Java for .jar files?

    Go with Arne's advice.

    BTW, "Java", being a trademark, is spelled with a capital "J", and the word
    "I" in English, being English, should always be capitalized. This is good
    discipline for those who program in the Java language, which is case sensitive.

    --
    Lew
    Last edited by a moderator: Jan 23, 2010
    Lew, Nov 16, 2008
    #3
  4. > ..I need to
    > convert my .class file into native windows machine executable (.exe)
    > that does not require JRE. How do I do it? Does the java JDK include a
    > file that converts it into .exe? Thanks


    <http://pscode.org/javafaq.html#exe>

    A better deployment option for this app.
    might be JWS (JAva webstart), using the
    deployJava.js to ensure the end user has
    a suitable JRE.

    Here are some basic examples of webstart
    launch related to the webstart API.
    <http://pscode.org/jws/>

    --
    Andrew T.
    pscode.org
    Last edited by a moderator: Jan 23, 2010
    Andrew Thompson, Nov 16, 2008
    #4
  5. G

    Guest

    > I know people are getting tired of answering it, and i've been
    > searching the web for hours, but i still don't get it! I need to
    > convert my .class file into native windows machine executable (.exe)
    > that does not require JRE. How do I do it? Does thejavaJDK include a
    > file that converts it into .exe? Thanks


    This article has all the answers:

    http://www.excelsior-usa.com/articles/java-to-exe.html

    LDV
    Last edited by a moderator: Jan 23, 2010
    , Nov 17, 2008
    #5
  6. G

    Roedy Green Guest

    <> wrote, quoted or indirectly quoted someone who
    said :

    >I know people are getting tired of answering it, and i've been
    >searching the web for hours, but i still don't get it! I need to
    >convert my .class file into native windows machine executable (.exe)
    >that does not require JRE. How do I do it? Does the java JDK include a
    >file that converts it into .exe? Thanks

    see http://mindprod.com/jgloss/nativecompiler.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Your old road is
    Rapidly agin'.
    Please get out of the new one
    If you can't lend your hand
    For the times they are a-changin'.
    Last edited by a moderator: Jan 23, 2010
    Roedy Green, Nov 17, 2008
    #6
  7. G

    Roedy Green Guest

    <> wrote, quoted or indirectly quoted someone who
    said :

    > I need to
    >convert my .class file into native windows machine executable (.exe)
    >that does not require JRE. How do I do it? Does the java JDK include a
    >file that converts it into .exe? Thanks


    What you probably want instead is an installer that will download and
    install the JRE if it is missing, then install your app.

    See http://mindprod.com/jgloss/installer.html

    The catch is, you then need separate installers for each platform.

    Another way to do it is to check if Java is installed with JavaScript,
    and if not, display some instructions on what to do. They are not much
    harder than installing an ordinary app. There is a psychological
    barrier.

    Consider thought that Flash, Adobe PDF need a run time too, and Users
    install them without resistance. All they need is a little hand
    holding.

    You might try getting them installed with those ghastly OBJECT EMBED
    tags.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Your old road is
    Rapidly agin'.
    Please get out of the new one
    If you can't lend your hand
    For the times they are a-changin'.
    Last edited by a moderator: Jan 23, 2010
    Roedy Green, Nov 17, 2008
    #7

  8. > I need to
    > >convert my .class file into native windows machine executable (.exe)
    > >that does not require JRE. How do I do it? Does the java JDK include a
    > >file that converts it into .exe? Thanks

    >
    > What you probably want instead is an installer that will download and
    > install the JRE if it is missing, then install your app.
    >
    > Seehttp://mindprod.com/jgloss/installer.html
    >
    > The catch is, you then need separate installers for each platform.
    >
    > Another way to do it is to check if Java is installed with JavaScript,


    deployJava.js is the currently recommended script,
    and it completely replaces the (much despised*)..

    > You might try getting them installed with those ghastly OBJECT EMBED
    > tags.


    ...nested OBJECT/EMBED elements.

    --
    Andrew Thompson
    http://pscode.org/
    Last edited by a moderator: Jan 23, 2010
    Andrew Thompson, Nov 17, 2008
    #8
  9. G

    GK Guest

    > I know people are getting tired of answering it, and i've been
    > searching the web for hours, but i still don't get it! I need to
    > convert my .class file into native windows machine executable (.exe)
    > that does not require JRE. How do I do it? Does the java JDK include a
    > file that converts it into .exe? Thanks


    What about the GNU Java Compiler (gcj)?
    Last edited by a moderator: Jan 23, 2010
    GK, Nov 19, 2008
    #9
  10. G

    Lew Guest

    GK wrote:
    > What about the GNU Java Compiler (gcj)?


    I've never been satisfied with it. It hasn't played well with standard code.
    I don't know if it's current with modern Java yet; it didn't used to be. I
    haven't seen evidence that it's popular. Give it a try. My information is
    old. Things might've improved.

    I won't bother, though.

    --
    Lew
    Lew, Nov 19, 2008
    #10
  11. Lew wrote:
    > GK wrote:
    >> What about the GNU Java Compiler (gcj)?

    >
    > I've never been satisfied with it. It hasn't played well with standard
    > code. I don't know if it's current with modern Java yet; it didn't used
    > to be. I haven't seen evidence that it's popular. Give it a try. My
    > information is old. Things might've improved.


    Judging from gcj's homepage (<http://gcc.gnu.org/java/>), it now
    supports "all 1.5 language features." What it still handles quite poorly
    is library support, although I think OpenJDK should ameliorate that.

    --
    Beware of bugs in the above code; I have only proved it correct, not
    tried it. -- Donald E. Knuth
    Joshua Cranmer, Nov 19, 2008
    #11
  12. G

    Arne Vajhøj Guest


    >> I know people are getting tired of answering it, and i've been
    >> searching the web for hours, but i still don't get it! I need to
    >> convert my .class file into native windows machine executable (.exe)
    >> that does not require JRE. How do I do it? Does thejavaJDK include a
    >> file that converts it into .exe? Thanks

    >
    > This article has all the answers:
    >
    > http://www.excelsior-usa.com/articles/java-to-exe.html


    Considering that is is from a tool vendor, then it
    is actually not that bad.

    Arne
    Last edited by a moderator: Jan 23, 2010
    Arne Vajhøj, Nov 20, 2008
    #12
  13. G

    Arne Vajhøj Guest


    >> I know people are getting tired of answering it, and i've been
    >> searching the web for hours, but i still don't get it! I need to
    >> convert my .class file into native windows machine executable (.exe)
    >> that does not require JRE. How do I do it? Does the java JDK include a
    >> file that converts it into .exe? Thanks

    >
    > What about the GNU Java Compiler (gcj)?


    If you can live with:
    - a library that is many years behind current Java
    - worse performance than a modern JVM
    - the occasional bug
    then it is an option.

    Arne
    Last edited by a moderator: Jan 23, 2010
    Arne Vajhøj, Nov 20, 2008
    #13
  14. Joshua Cranmer wrote:
    > Lew wrote:
    >> GK wrote:
    >>> What about the GNU Java Compiler (gcj)?

    >>
    >> I've never been satisfied with it. It hasn't played well with
    >> standard code. I don't know if it's current with modern Java yet; it
    >> didn't used to be. I haven't seen evidence that it's popular. Give
    >> it a try. My information is old. Things might've improved.

    >
    > Judging from gcj's homepage (<http://gcc.gnu.org/java/>), it now
    > supports "all 1.5 language features." What it still handles quite poorly
    > is library support, although I think OpenJDK should ameliorate that.


    http://builder.classpath.org/japi/jdk15-classpath.html compares
    ClassPath to Java 1.5 (which is from 2004).

    Their official roadmap says:

    <quote>
    GNU Classpath 1.0 will be fully compatible with the 1.1 and 1.2 API
    specifications, in addition to having significant (>95%) compatability
    with the 1.3, 1.4, 1.5 and 1.6 APIs. Our target for this release will be
    to be fully API compatabile with the core of 1.5 (i.e. java.*, not
    javax.*) and to have a number of significant applications (to be
    determined by user input) running well. The vast majority of the 1.4 and
    1.5 APIs will be available, along with a stable API for interacting with
    virtual machines.
    </quote>

    In my book "95% compatibility" means "not compatible".

    Arne
    Arne Vajhøj, Nov 20, 2008
    #14
  15. G

    GK Guest

    On Nov 20, 3:51 am, Arne Vajhøj <> wrote:

    > > What about the GNU Java Compiler (gcj)?

    >
    > If you can live with:
    > - a library that is many years behind current Java


    You could use Sun libraries, or OpenJDK or others, i'm quite sure gcj
    won't care ;-)

    > - worse performance than a modern JVM


    The performance is obviously case dependent: http://www.stefankrause.net/wp/?p=9
    (gcc 4.2.3 is used for comp., which is outdated. I always wanted to
    run his tests on my machine with gcc 4.3.2 ...)

    > In my book "95% compatibility" means "not compatible".


    I'm with you, but the missing/incompatible 5% are package javax.jws.
    These don't make sense for an execetubale, doesn't it? And some of
    them can't be remade because of license issues; A project adressing
    that issue may be found here: http://www.gnu.org/software/classpathx/

    BTW: in http://builder.classpath.org/japi/ there are a lot more
    comparissons other versions and OpenJDK.

    Gernot
    GK, Nov 20, 2008
    #15
  16. G

    Arne Vajhøj Guest

    GK wrote:
    > On Nov 20, 3:51 am, Arne Vajhøj <> wrote:
    >>> What about the GNU Java Compiler (gcj)?

    >> If you can live with:
    >> - a library that is many years behind current Java

    >
    > You could use Sun libraries, or OpenJDK or others, i'm quite sure gcj
    > won't care ;-)


    If you like do to integration work.

    >> - worse performance than a modern JVM

    >
    > The performance is obviously case dependent: http://www.stefankrause.net/wp/?p=9
    > (gcc 4.2.3 is used for comp., which is outdated. I always wanted to
    > run his tests on my machine with gcc 4.3.2 ...)


    Benchmark results practically always depends on the benchmark used.

    But since GCJ is not tested in at the page you link to, then it
    does not contradict my general claim.

    >> In my book "95% compatibility" means "not compatible".

    >
    > I'm with you, but the missing/incompatible 5% are package javax.jws.


    No.

    Not according to their own doc:
    http://builder.classpath.org/japi/jdk15-classpath.html

    Arne
    Arne Vajhøj, Nov 21, 2008
    #16
  17. G

    GK Guest

    On Nov 21, 1:37 am, Arne Vajhøj <> wrote:

    > > You could use Sun libraries, or OpenJDK or others, i'm quite sure gcj
    > > won't care ;-)

    >
    > If you like do to integration work.


    If one really wants the .exe, that could be true. Depends one your
    requirements. But what do you want? There's always some work to be
    done, that's why i'm sitting at my desk early in the morning :)

    > Benchmark results practically always depends on the benchmark used.


    Yes, but humans tend to have some kind of measurement for things. And
    every benchmark is an indicator for a certain area or behaviour.

    > But since GCJ is not tested in at the page you link to, then it
    > does not contradict my general claim.


    You're right, but results should not differ too much, because of the
    frontend/backend gcc-architecture. Sorry, can't proof that one ...

    > >> In my book "95% compatibility" means "not compatible".

    >
    > > I'm with you, but the missing/incompatible 5% are package javax.jws.


    Sorry, typo: should have been: "I'm with you, but the missing/
    incompatible 5% are packages like javax.jws."
    There is really some seldomly used stuff on that list, but also some
    important classes. The classpath hackers still have work to do.

    Gernot
    GK, Nov 21, 2008
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sriraj
    Replies:
    4
    Views:
    646
    Roedy Green
    Oct 18, 2005
  2. davidb
    Replies:
    2
    Views:
    1,004
    davidb
    Aug 30, 2006
  3. som
    Replies:
    14
    Views:
    602
    Andrew Thompson
    Feb 16, 2007
  4. Replies:
    4
    Views:
    480
    Maett
    Jan 9, 2006
  5. Muzammil
    Replies:
    1
    Views:
    1,072
    red floyd
    Aug 28, 2008
Loading...

Share This Page