Thread: GCJ & GCC, MingW

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    GCJ & GCC, MingW

    I've just recently heard of a GNU compiler tool called GCJ that can compile Java byte code into a target machine native language. After visiting the website I am led to believe from the downloads section that GCJ is included with GCC. So my question is how does one invoke the GCJ compiler through GCC or MingW?

  2. #2
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    I'm not so sure it get's packaged with the default download of gcc, it's just part of the gcc project. The name of the executable is gcj and libgcj is the library. IIRC, it's linux only.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    88
    I am also interested in some experiences with gjc.

    Is java then nearly fast as it would be written in C or C++?

    From my understanding of the wiki article, gjc is currently only experimental. Isn`t fully compatible with jre and therefore not all librarys are working?

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by sept View Post
    Is java then nearly fast as it would be written in C or C++?
    It would still work a little differently, with garbage collection and such.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Actually, I heard that GCJ has received so little attention that it is not very optimized; supposedly the native code generated by GCJ is slower than Sun's JVM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Registered User
    Join Date
    Jul 2007
    Posts
    88
    Uhm, that`s worse. Then the only advantage is that you don`t need jre and save a lot of support querys that either jre is not installed or can not be installed for strange reasons.

    Please split this if that`s going to much off topic.

    What about the commercial java to native compilers? Are them better then jre (forget in meanwhile about portability)?

  7. #7
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Quote Originally Posted by Perspective
    The name of the executable is gcj and libgcj is the library. IIRC, it's linux only.
    No it isn't. I've used it under MinGW just fine although I never did much with it. If you want it, just grab gcc-java-3.4.5-20060117-1.tar.gz and uncompress it into where mingw is.

  8. #8
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    awesome thanks!
    Any links that corroborate the snag about compiled native code being less effecient than byte code/JVM?
    Also, are there any other libraries/compilers that do the same thing? (JDK can't right?)

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Here's some numbers. This test looks extensive and rather fair:
    http://www.shudo.net/jit/perf/

    There is only one test where gcj beats the Sun JVM, and that's the Sieve of Eratosthenes. In all others, gcj is slower, sometimes by quite a margin.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with MinGW gcc?
    By whOOper in forum C Programming
    Replies: 1
    Last Post: 04-22-2009, 09:35 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Replies: 4
    Last Post: 09-02-2007, 08:47 PM
  4. Compiles on gcc 3.3 but not on gcc 4.0.3
    By cunnus88 in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2007, 12:24 PM
  5. gcc
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 10-22-2003, 03:46 PM