What is the role of JRE and TVM in java?

Can anyone tell me What is the role of JRE and JVM in Java?

And what is the difference between those two?

Replies

  • Mahesh Dahale
    Mahesh Dahale
    - JRE refers to java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE.
    - If you want to run any java program, you need to have JRE installed in the system




    -A JVM refers to (Java Virtual Machine). This the system that executes our Java programs.
    -Java is designed so that any java program can run on any machine. This is because the JVM will interpret the Operating System independent java code and execute the commands needed for the particular Operating System you are trying to run the program on at the time.
    -it is a set of computer software programs and data structures that use a virtual machine model for the execution of other computer programs and scripts.
    -understand the corresponding byte code of a java class and make it ready for run.
  • sookie
    sookie
    Can anyone tell me what is TVM in Java? 😁

    Ok, coming to the question, I will try to clear the entire doubt that most of the people have regarding three different terms JDK, JVM and JRE.

    Let me first talk about only JDK and JRE, the very first thing one need to be cleared while installing java in the system.

    JRE [Java RunTime Environment] provides an environment for running[Note : not for compiling also] your Java programs. It contains JVM, class libraries and other supporting files but not compiler and debugging tools. The compiler and debugging tools are packed in JDK[Java Development toolkit] . If you have Java installed in your system check the jdk folder. Inside it there will be a jre folder also. So even if you have not installed jre in your system, you will find you are able to both compile and run Java programs but if you have installed only jre, it will have not have javac.exe in its bin folder. It will have only java.exe. For the sake of lazy people like you, I will show you with images.

    1. Both jdk and jre folders in my system
    [​IMG]

    2. Check inside jre folder, Go to its bin folder, you will see only "java.exe". No "javac.exe" is there.
    [​IMG]

    3. Now do the same as above with "jdk" folder. You will find both "java/exe" and "javac.exe" will be there.
    [​IMG]

    2. And if you see inside jdk folder, you will see a jre folder also.
    [​IMG]

    So this was the role of JRE AND JDK. If you want to only run the Java programs, you can do so only installing jre[As it is done in most of the client machines] but if your are developing Java programs, you definitely need to install jdk.

    Now let's come to the role of JVM which has no comparison to JRE. JRE - provides you an environment for running Java programs. Running Java programs means converting Java .class files[also called as bytecodes] into executable files.

    JVM[Java Virtual Machine] concept is introduced for making platform independent programs . It is an engine that interprets the bytecodes [.class files] and convert them into machine code based on the underlying hardware and OS of the machine. JVM acts as an interface to the machine and JRE is its implementaion. Using JRE, you make the programs runnable but it is JVM that decides how to make that program runnable 'everywhere'. JVM is machine dependent but it is called as "virtual" as it is only an interface to the machine irrespective of machine's architecture.

    Hope you got the point now. Feel free to add more or correct me.

You are reading an archived discussion.

Related Posts

Google has launched a new tool called 'Swirl', which will help users to find images in an easier way. The tool automatically groups similar images into categories presented on results...
License: Freeware Operating systems: Win XP/Windows Vista/Win 2000/Win 2003 Server File size: 17.5MB Wireshark (previosuly known as Ethereal) is a popular, free tool for analysing your network. Wireshark analyzes the...
Microsoft Corp said on Tuesday it will launch its long-awaited Windows Azure cloud computing system on Jan 1, as it looks to take advantage of the growing interest in internet-based...
I just got the news that our CEan Mahesh_Dahale is now Microsoft Certified Professional 😁😁😁 Heartiest congratulations to Mahesh! Rock on!
CEans, Here's our review of the book - https://www.crazyengineers.com/threads/prisoners-of-hate-by-c-v-murali-book-review.62820/ If you have any questions, comments; post them here. We'll try to have the author to comment 😀 Best,