Results 1 to 16 of 16
  1. #1
    zachwong is offline Member
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default Building projects with the JRE (not the JDK) in Eclipse

    Hi,

    Just curious. I noticed in the Eclipse documentation the following:

    By default, the JRE used to run the workbench will be used to build and run Java programs. It should appear with a checkmark in the list of installed JREs. We recommend that you use a Java SDK instead of a JRE. An SDK is designed for development and contains the source code for the Java library, easing debugging.

    How does this work? Does this mean you can compile code with the JRE? My understanding is that you can only compile using "javac".

    Any ideas?

    Thanks

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    I think you know about the meaning of two terminologies. JDK(Java Development Kit) and the JRE(Java Runtime Environment). As it said, you need JDK installed in your machine to develop Java applications. To run a Java application you need the runtime environment, you must.

    Using JRE you can't develop any Java application. But if you have JDK installed then you can develop as well as run Java applications. That's JDK includes the JRE also.

    Hope it's clear to you.

  3. #3
    zachwong is offline Member
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default

    Thanks for the quick reply!

    I had the JRE1.6 installed when I first got my home computer (to run misc. Java apps on my home computer). In the JRE1.6 bin/ directory, there is no "javac" compiler.

    I installed Eclipse today and was surprised to find that I was able to compile java code... despite the fact that the JRE is missing the java compiler.

    To double check I didn't have a JDK installed on my computer, I did a search for "javac" and there was no results.

    So I was just wondering how this could possibly be happening. Could Eclipse be using my compiler-less JRE1.6 to build code? Doesn't sound right, but I can't think of any otherway this is happening.

    Thanks

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    You said that, without having install the JDK package you can compile a Java project in Eclipse? But you can't run it? It can't happened, if you install JDK then there should be JRE too. B

    By the way did you installed complete Eclipse package?

  5. #5
    zachwong is offline Member
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default

    I said that without having installed the JDK, and only having JRE1.6 installed, I can compile Java code in Eclipse. My thoughts are that if I don't have the JDK, then I shouldn't be able to build anything. Since I have a JRE, then I should be able to run it.

    In my first post, I posted an excerpt from the Eclipse documentation. It sounds like you don't need a JDK, but you can compile with the JRE?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    What program does eclipse use to compile java source?
    It must include a JDK in its install.

    The JRE doesn't include the javac and jar programs.

  7. #7
    zachwong is offline Member
    Join Date
    Jul 2008
    Posts
    4
    Rep Power
    0

    Default

    It doesn't appear come with a JDK ... the prerequisite to run Eclipse is having either a JRE or JDK installed on the system.

    I have JRE1.6 and despite having searched my system for the javac compiler, I couldn't find it... yet somehow... my small java test (Hello World) is still compiling.

  8. #8
    killua is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    I have the same doubt with zachwong.
    Only JRE installed, but eclipse is able to compile your java file.
    After searching, I got a word "jrew". Someone said that jrew is another kind of binary version of javac and some other files contained in JDK.
    And Eclipse uses this tool to compile java file without JDK installed.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by zachwong View Post
    It doesn't appear come with a JDK ... the prerequisite to run Eclipse is having either a JRE or JDK installed on the system.

    I have JRE1.6 and despite having searched my system for the javac compiler, I couldn't find it... yet somehow... my small java test (Hello World) is still compiling.
    Never it can't happen. There should be JDK install. If you can't find that there should be another Java compiler. javac is not the only one we have. May be another one is attached to Eclipse. I'm not an Eclipse user, so I don't know that is possible or not.

  10. #10
    killua is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Never it can't happen. There should be JDK install. If you can't find that there should be another Java compiler. javac is not the only one we have. May be another one is attached to Eclipse. I'm not an Eclipse user, so I don't know that is possible or not.
    I also believe that java can't be compiled without java compiler.
    But the truth is that even you can't find javac in your computer, eclipse is still able to compile your java file.

    So I think now the problem is that what is the SPECIFIC kind of compiler eclipse is using?

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by killua View Post
    I have the same doubt with zachwong.
    Only JRE installed, but eclipse is able to compile your java file.
    After searching, I got a word "jrew". Someone said that jrew is another kind of binary version of javac and some other files contained in JDK.
    And Eclipse uses this tool to compile java file without JDK installed.
    Yep it is. There are large number of Java compilers are available. javac is not the only one. javac comes with the JDK bundle.

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by killua View Post
    I also believe that java can't be compiled without java compiler.
    But the truth is that even you can't find javac in your computer, eclipse is still able to compile your java file.

    So I think now the problem is that what is the SPECIFIC kind of compiler eclipse is using?
    Not only in Java, in any language to compile the source code you need a compiler. It's must.

    As I said earlier there should be another compile attached to the Eclipse. But sorry I can't comment on that. Because I'm not an Eclipse user. ;) May someone else can comment on this, or may be there are more information about that this in Eclipse web site.

  13. #13
    killua is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Not only in Java, in any language to compile the source code you need a compiler. It's must.

    As I said earlier there should be another compile attached to the Eclipse. But sorry I can't comment on that. Because I'm not an Eclipse user. ;) May someone else can comment on this, or may be there are more information about that this in Eclipse web site.
    Hi Eranga,:)
    I have find one excellent article about Eclipse Compiler. But I can't post a link here with only 2 replys...I've just send the link to you by private message, Could you post the link in this post for me?
    Thx a lot!

    ONJava.com -- What's New in Eclipse 3.2 Java Development Tools
    Last edited by Eranga; 09-22-2008 at 03:35 PM. Reason: Adding a link by user request. It's related to this post directly.

  14. #14
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default Eclipse has its own compiler

    Eclipse is a Java app, hence it needs a JRE to run. But it uses its own internal, incremental compiler - ECJ - rather than javac. You can persuade it to use other compilers, but it's rarely worth the effort

  15. #15
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Quote Originally Posted by killua View Post
    I also believe that java can't be compiled without java compiler.
    But the truth is that even you can't find javac in your computer, eclipse is still able to compile your java file.

    So I think now the problem is that what is the SPECIFIC kind of compiler eclipse is using?
    ECJ: The Eclipse Compiler for Java. It's true that one needs a compiler to compile Java source code, but it needn't be the Sun reference compiler, javac

  16. #16
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Java Projects
    By yiweiang in forum New To Java
    Replies: 2
    Last Post: 12-15-2011, 02:28 AM
  2. Group Projects
    By Zosden in forum Advanced Java
    Replies: 11
    Last Post: 06-03-2008, 04:47 AM
  3. Projects please
    By sudhir in forum Introductions
    Replies: 1
    Last Post: 12-17-2007, 02:42 PM
  4. Java Projects
    By Zeke886 in forum New To Java
    Replies: 0
    Last Post: 11-14-2007, 09:41 PM
  5. Building A Java Project In Eclipse
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 05-22-2007, 10:34 PM

Posting Permissions

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