Chuyển tới nội dung
Home » Java Jdk And Jre | Jre Là Gì? Giới Thiệu Java Runtime Environment

Java Jdk And Jre | Jre Là Gì? Giới Thiệu Java Runtime Environment

#23 JDK JRE JVM in Java

Difference Between JDK, JRE and JVM

After reading the above introduction of all three components, now we will go through the table below to see the head-to-head difference between JDK JRE and JVM.

JDK JRE JVM
JDK stands for Java Development Kit. JRE stands for Java Runtime Environment. JVM stands for Java Virtual Machine.
The Java Development Kit (JDK) is a software development kit that lets you build Java applications. The Java Runtime Environment (JRE) is a software package that includes the Java Virtual Machine (JVM), class libraries, and other components required to run Java applications. The Java Virtual Machine (JVM) is an abstract machine that provides an environment for Java ByteCode execution.
JDK includes tools for creating, monitoring, and debugging Java code. JRE includes class libraries and other supporting files needed by JVM to run Java code. JVM has no software development tools.
It is platform-dependent It is also platform-dependent like JDK It is platform-independent
The JDK mainly assists in code execution. Its primary purpose is development. JRE is primarily tasked with creating an environment for code execution. All implementations are specified by JVM. It is in charge of providing all of these implementations to the JRE.
JDK = Development Tools + JRE JRE = Class libraries + JVM JVM = provides a runtime environment.

ConclusionIn essence, comprehending the disparity between JDK, JRE, and JVM is crucial for any Java developer. The JDK encompasses the complete set of tools needed for Java development, including the JRE, whereas the JRE is an execution environment for running Java applications. On the other hand, the JVM is the runtime instance that executes Java bytecode. Together, these components form a cohesive ecosystem that facilitates Java programming, ensuring seamless development, deployment, and execution of Java applications across various platforms.

Runtime Enviroment là gì?

Một chương trình phần mềm cần phải thực thi và để thực hiện nó cần một môi trường để chạy. Runtime Enviroment tải các tệp lớp và đảm bảo có quyền truy cập vào bộ nhớ và các tài nguyên hệ thống khác để chạy chúng. Trước đây, hầu hết các phần mềm đều sử dụng hệ điều hành (HĐH) làm Runtime Enviroment. Chương trình chạy bên trong bất kỳ máy tính nào được bật, nhưng dựa vào cài đặt hệ điều hành để truy cập tài nguyên. Tài nguyên trong trường hợp này sẽ là những thứ như bộ nhớ và tệp chương trình và dependencies. Java Runtime Enviroment đã thay đổi tất cả, ít nhất là đối với các chương trình Java.

JRE chứa các thư viện và phần mềm mà các chương trình Java của bạn cần chạy. Ví dụ, trình tải lớp Java là một phần của Java Runtime Environment. Phần mềm quan trọng này tải mã Java được biên dịch vào bộ nhớ và kết nối mã với các thư viện lớp Java thích hợp.

#23 JDK JRE JVM in Java
#23 JDK JRE JVM in Java

Just-in Time Compiler (JIT)

JIT compiler is a component that is part of the JVM and hence its implementation JRE. JIT runs when the Java program is interpreted and its objective is to optimize the Java program and make it efficient in terms of performance.

Last Updated on December 11, 2023 by Ankit Kochar

In the world of Java programming, the terminologies JDK (Java Development Kit), JRE (Java Runtime Environment), and JVM (Java Virtual Machine) hold pivotal roles. Understanding the differences among these components is fundamental for Java developers, as they form the backbone of Java application development. Each serves a distinct purpose in the execution and development of Java-based software.

Quản lý bộ nhớ trong java 8

Cho đến Java 8, metaspace được biết đến như là permgen. Bên cạnh việc là một cái tên hay hơn nhiều, metaspace là một thay đổi quan trọng đối với cách các nhà phát triển tương tác với không gian bộ nhớ của Java. Trước đây, bạn sẽ sử dụng lệnh * java -XX: MaxPermSize* để theo dõi kích thước của không gian permgen. Từ Java 8 trở đi, Java sẽ tự động tăng kích thước của metaspace để đáp ứng nhu cầu meta của chương trình của bạn. Java 8 cũng giới thiệu một cờ mới, MaxMetaspaceSize, có thể được sử dụng để giới hạn kích thước metaspace.

Các tùy chọn bộ nhớ khác, heap và stack, vẫn giữ nguyên trong Java 8.

Understand the Differences between JVM vs JRE vs JDK in java in one video #1.3
Understand the Differences between JVM vs JRE vs JDK in java in one video #1.3

What is JRE?

JRE stands for Java Runtime Environment. It is a runtime environment that is used for running the java applications in our system. The JRE contains JVM (Java Virtual Machine) along with a set of libraries and utilities that are required in order to run java applications. When we try to execute a java application, a runtime environment is provided by the JRE that contains all the necessary components that are required by the application to execute.

Features of JRE:

  • JRE is a collection of tools that helps in the execution of the JVM. It also provides a few deployment tools like Java Plug-in and Java Web Start.
  • A user can run java code efficiently with only JRE. Unfortunately, JRE does not allow writing java programs.
  • JRE also includes some integration libraries such as JDBC (Java Database Connectivity), JNDI (Java Naming and Directory Interface), RMI (Remote Method Invocation), and others.
  • In addition to JVM, it also contains a virtual machine client for Java HotSpot.

What is JVM?

JVM stands for Java Virtual Machine, and it is a software component that allows your computer to run Java programs. When we write a Java program, it is compiled into bytecode. This bytecode can not execute on its own and requires JVM to run it.

The JVM has the responsibility of executing the bytecode and converting it into machine code that can be understood by the computer. The JVM also manages memory usage and performs garbage collection, which is the process of deallocating memory that is no longer needed by the program.

Listed below are some features of JVM

  • JVM converts byte code into machine code which is understood by the computer.
  • JVM provides fundamental Java functionalities such as management of memory, garbage collection, and so on.
  • JVM uses libraries and files of JRE to run the java program.
  • JVM is an essential component of JRE.
  • It is capable of executing the java program line by line. Hence, it is also referred to as an interpreter.
  • Primary functions of JVM includes program loading, linking, initialization, and compilation.
Java: The JVM, JRE, and JDK - Explained Analogy-Style!
Java: The JVM, JRE, and JDK – Explained Analogy-Style!

JDK, JRE, Java, Java Virtual Machine và Java Compiler có gì khác nhau?

JDK = JRE + Các công cụ hỗ trợ phát triển ứng dụng Java compiler là một trong số các công cụ hỗ trợ phát triển ứng dụng của JDK. Java compiler được sử dụng để biên soạn các tập tin Java (đuôi .java) để tạo ra tập tin .class tương ứng.

Các gói JDK

Sau khi chọn phiên bản Java, bạn cũng sẽ cần chọn gói Java muốn sử dụng. Các gói là các Java Development Kit dành cho các kiểu phát triển khác nhau. Các gói có sẵn là Java Enterprise Edition (Java EE), Java Standard Edition (Java SE) và Java Mobile Edition (Java ME).

JVM (Java Virtual Machine): là máy ảo Java. Nó được dùng để thực thi các chương trình Java.

Mỗi nền tảng/hệ điều hành khác nhau (Windows, IOS, Linux…) lại có một loại JVM khác nhau. Hiểu nôm na thì các chương trình Java của các bạn chạy trên JVM. Nói Java đa nền tảng, thực chất thì nó được hỗ trợ JVM trên nhiều nền tảng. Chương trình Java chạy được trên Window/Linux/IOS vì nó có JVM chạy được trên các nền tảng đó.

Thông thường, một phiên bản JDK sẽ chứa Java SE. Nếu bạn tải xuống Java EE hoặc Java ME, bạn sẽ có một phiên bản Java SE tiêu chuẩn. Ví dụ, Java EE là nền tảng tiêu chuẩn với các công cụ bổ trợ tiện ích cho phát triển ứng dụng doanh nghiệp như Enterprise JavaBeans hay hỗ trợ cho Object Relational Mapping.

Việc chuyển đổi từ JDK này sang JDK cũng không có gì khó khăn. Vì vậy, bạn không cần phải quá lo lắng về việc chọn đúng phiên bản và gói JDK ngay từ đầu.

Đọc thêm: Download java jdk

JDK trong câu lệnh

Cài đặt JDK và JRE sẽ thêm lệnh java vào command của bạn. Bạn có thể xác minh bằng cách mở command shell và gõ java -version, bạn sẽ nhận được phiên bản Java vừa cài đặt. (Trong một số trường hợp, bạn sẽ phải khởi động lại hệ thống để nhận các thay đổi). Ngoài ra. bạn cũng sẽ cần javac này để biên dịch các tệp Java của bạn.

Lệnh javac

Lệnh javac nằm trong thư mục “/jdk”, nhưng sẽ không được tự động thêm vào path của hệ thống trong khi cài đặt. Bạn sẽ có tùy chọn để tự cài đặt javac hoặc cài đặt một IDE có chứa lệnh này.

Đừng quên theo dõi khóa học lập trình bên Vntalking nhé!

All rights reserved

Cấu hình không gian ngăn xếp(Configuring stack space)

Không gian ngăn xếp là nơi các hàm gọi và tham chiếu biến được xếp hàng. Không gian ngăn xếp là nguồn gốc của lỗi nổi tiếng thứ hai trong lập trình Java: ngoại lệ tràn ngăn xếp (đầu tiên là ngoại lệ con trỏ null). Ngoại lệ tràn ngăn xếp chỉ ra rằng bạn đã hết dung lượng ngăn xếp vì quá nhiều phần đã được bảo lưu. Thông thường, bạn sẽ nhận được một ngăn xếp tràn khi một phương thức hoặc phương thức gọi nhau theo kiểu vòng tròn, do đó dành một số lượng lớn các lệnh gọi hàm ngày càng tăng vào ngăn xếp.

Bạn sử dụng công tắc -Xss để định cấu hình kích thước bắt đầu ngăn xếp. Ngăn xếp sau đó phát triển linh hoạt theo nhu cầu của chương trình.

JDK là gì? Giới thiệu Java Development Kit

JDK là một thành phần nền tảng chính để xây dựng các ứng dụng Java. Trái tim của nó là trình biên dịch Java.

Java Development Kit (JDK) là một trong ba gói công nghệ cốt lõi được sử dụng trong lập trình Java, cùng với JVM (Java Virtual Machine) và JRE (Java Runtime Environment)

JRE có thể được sử dụng như một thành phần độc lập để chạy các chương trình Java, nhưng nó cũng là một phần của JDK. JDK yêu cầu JRE vì chạy các chương trình Java là một phần của việc phát triển chúng.

Các định nghĩa:

  • Định nghĩa kỹ thuật: JDK là một triển khai của đặc tả nền tảng Java, bao gồm các trình biên dịch và thư viện lớp.
  • Định nghĩa hàng ngày: JDK là gói phần mềm bạn tải xuống để tạo các ứng dụng dựa trên Java.

Nguồn tham khảo: https://www.javaworld.com/article/3272244/what-is-the-jvm-introducing-the-java-virtual-machine.html https://www.javaworld.com/article/3296360/what-is-the-jdk-introduction-to-the-java-development-kit.html https://www.javaworld.com/article/3304858/what-is-the-jre-introduction-to-the-java-runtime-environment.html

All rights reserved

By Pankaj

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

The difference between JDK, JRE, and JVM is one of the popular interview questions. You might also be asked to explain JDK vs JRE vs JVM.

JDK, JRE, and JVM are core concepts of Java programming language. We don’t use these concepts in programming. But, as a Java developer, we should know about them.

Java Development Kit aka JDK is the core component of Java Environment and provides all the tools, executables, and binaries required to compile, debug, and execute a Java Program. JDK is a platform-specific software and that’s why we have separate installers for Windows, Mac, and Unix systems. We can say that JDK is the superset of JRE since it contains JRE with Java compiler, debugger, and core classes.

JVM is the heart of Java programming language. When we execute a Java program, JVM is responsible for converting the byte code to the machine-specific code. JVM is also platform-dependent and provides core java functions such as memory management, garbage collection, security, etc. JVM is customizable and we can use java options to customize it. For example, allocating minimum and maximum memory to JVM. JVM is called virtual because it provides an interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and the operating system makes java program write-once-run-anywhere.

JRE is the implementation of JVM. It provides a platform to execute java programs. JRE consists of JVM, Java binaries, and other classes to execute any program successfully. JRE doesn’t contain any development tools such as Java compiler, debugger, JShell, etc. If you just want to execute a java program, you can install only JRE. You don’t need JDK because there is no development or compilation of java source code is required. Now that we have a basic understanding of JDK, JVM, and JRE, let’s look into the difference between them.

Let’s look at some of the important differences between JDK, JRE, and JVM.

Sometimes you will find JIT alongside JVM, JDK, and JRE in textbooks. JIT is part of the JVM that optimizes the process of converting byte code to machine-specific language. It compiles similar byte codes at the same time and reduces the overall time taken for the compilation of byte code to machine-specific language.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Below text from this article – JVM is called virtual because it provides an interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and the operating system is what makes java program write-once-run-anywhere. Does JVM provided interface not depend on underlying platform. If that interface (i.e. loding, linking, JIT, interpreter etc) is same for all platforms then why JVMs are different for each platform. I feel this interface which takes byte code as input and gives you end result is platform dependent which makes Java platform independent. May be you can correct my understanding.

– Love Gupta

Thanks a lot!

– Saangram

Please update the version of Java.

– srinivas narla

very well explained,

– Vitthal Kasbe

JVM is also platform dependent under JVM , i hope this is a TYPO.

– Sailendra

I wish to know step by step execution and impacts , functionalties for jdk, jvm (including memory areas )m jre ? I mean i wish to know end-to-end flow when a java program gets executed (specially through various section inside JVM – among those i also wish to know impacts on memory areas (heap,stack, native area ), class loaders e.t.c.

– Bibhu Prasad Tripathy

very good.

– Leandro

Hi Pankaj, Thanks for such useful tutorials. You are doing great. Keep it up. I have some doubt about JIT. You said that it optimizes byte code to machine specific language compilation by compiling similar byte codes at same time. My question is that while converting byte code into machine specific code do all the byte code passes through JIT. Because i have heared that only interpretor also have its role in converting byte code into machine specific code. Or only similar byte codes are passes through JIT and rest all passes through interpreter. It would be very useful if you can elaborate it with some example.

– debu

This is to just let you know that you could update regarding ‘Current JDK Version’ information.

– gansai

I’m confused when I go to Oracles site to download the JDK and they ask if you want JDK for Java EE or JDK for Java SE. What if I want to ability to develop both. Do I really have to install 2 separate JDKs?

– Mike

Click below to sign up and get $200 of credit to try our products over 60 days!

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Hiểu rõ sự khác nhau giữa JDK, JRE và JVM là điều khá quan trọng trong Java.

Nội dung chính

JVM, JRE và JDK Trong Java: Bạn Biết Chọn Cái Nào Chưa? | Code Thu
JVM, JRE và JDK Trong Java: Bạn Biết Chọn Cái Nào Chưa? | Code Thu

Tìm hiểu JVM

JVM (viết tắt của Java Virtual Machine) là một thiết bị trừu tượng (ảo) có thể giúp máy tính chạy các chương trình Java. Nó cung cấp môi trường runtime mà trong đó Java Bytecode có thể được thực thi.

JVM là có sẵn cho nhiều nền tảng (Windows, Linux…). JVM, JRE và JDK là phụ thuộc nền tảng, bởi vì cấu hình của mỗi OS (hệ điều hành) là khác nhau. Nhưng, Java là độc lập nền tảng.

Các nhiệm vụ chính của JVM

  • Tải code
  • Kiểm tra code
  • Thực thi code
  • Cung cấp môi trường runtime

Cấu trúc của JVM

Trong đó:

  • Classloader: Là một hệ thống con của JVM được sử dụng để tải class file.
  • Class (method) Area: Lưu trữ cấu trúc mỗi lớp, chẳng hạn như hằng, trường, dữ liệu phương thức, code của phương thức, …
  • Heap: Nó là khu vực dữ liệu runtime mà trong đó đối tượng được cấp phát.
  • Stack: Stack trong Java lưu giữ các Frame. Nó giữ các biến cục bộ và các kết quả cục bộ, và thực hiện một phần nhiệm vụ trong phần triệu hồi và trả về phương thức. Mỗi Thread có một Stack riêng, được tạo tại cùng thời điểm với Thread.
    Một Frame mới được tạo mỗi khi một phương thức được triệu hồi và bị hủy khi lời triệu hồi phương thức là kết thúc.
  • Program Counter Register: Nó chứa địa chỉ của chỉ lệnh JVM hiện tại đang được thực thi.
  • Native Method Stack: Bao gồm tất cả các phương thức tự nhiện được sử dụng trong ứng dụng.
  • Execution Engine: Phần này bao gồm:
    Một bộ xử lý ảo Virtual ProcessorMột trình thông dịch Interpreter. Đọc Bytecode Stream sau đó thực thi các chỉ thị.
  • Just-In-Time (JIT) Compiler: được sử dụng để cải thiện hiệu suất. JIT biên dịch các phần của Bytecode mà có cùng tính năng tại cùng một thời điểm, và vì thế giảm lượng thời gian cần thiết để biên dịch. Ở đây khái niệm Compiler là một bộ biên dịch tập chỉ thị của JVM thành tập chỉ thị của một CPU cụ thể.

Java Runtime Environment (JRE)

JRE is the software environment where the compiled Java byte codes executes. JRE is the implementation of JVM it includes the code required for running the programs and native code. It contains the implementation of Java interpreter, garbage collector, class loader, java class libraries and related files. You can download the JRE separately or as a bundle along with JDK from Oracle’s website.

2 - JDK and JRE : Java (Darija)
2 – JDK and JRE : Java (Darija)

Cấu hình không gian heap(Configuring heap space)

Không gian heap là phần động nhất của hệ thống bộ nhớ Java. Bạn có thể sử dụng các cờ -Xms và -Xmx để cho Java biết mức độ lớn để bắt đầu heap và mức độ lớn để cho phép nó trở thành. Hiểu cách điều chỉnh các cờ này cho các nhu cầu chương trình cụ thể là một khía cạnh quan trọng của quản lý bộ nhớ trong Java. Ý tưởng là làm cho heap đủ lớn để garbage collection hoạt động hiệu quả nhất. Đó là, bạn muốn cho phép đủ bộ nhớ để cho chương trình chạy, nhưng bạn không muốn nó lớn hơn mức cần thiết.

Difference Between JDK and JRE in Java

JDK and JRE are the core concepts in Java programming and their differences are some of the most popular interview questions. We don’t use these concepts while programming but if we want to become a Java developer, we must know about these concepts.

JDK

JDK stands for Java Development Kit. It is a software development environment used to develop Java applications and applets. It is a platform-specific software i.e there are separate installers for Windows, Mac, and Unix systems. Java developers can use it on their Windows, macOS, Solaris, and Linux to code and run Java programs. It contains Java Runtime Environment(JRE) and other development tools like an interpreter, compiler, archiver, and a document generator. We can possibly install more than one JDK version on the same computer.

JRE

JRE stands for Java Runtime Environment. It is the implementation of JVM (Java Virtual Machine) and it is specially designed to provide an environment to execute Java programs. It is also platform dependent like JDK. It consists of JVM, Java binaries, and other classes for the smooth execution of the program. It doesn’t contain any development tools like a compiler, debugger, etc. If we only want to execute a program, we just need to install JRE and not JDK, since there is no development or compilation of the code required.

Let’s see the main difference with the help of the below diagram:

Difference Between JDK and JRE

KEY JDK JRE
DEFINITION JDK(Java Development Kit) is used to develop Java applications. JDK also contains numerous development tools like compilers, debuggers, etc. JRE(Java Runtime Environment) is the implementation of JVM(Java Virtual Machine) and it is specially designed to execute Java programs.
FUNCTIONALITY It is mainly used for the execution of code and its main functionality is development. It is mainly used for creating an environment for code execution.
DEPENDENCY OF PLATFORM It is platform-dependent. It is also platform-dependent like JDK.
TYPE OF TOOLS Since JDK is responsible for the development purpose, therefore it contains tools which are required for development and debugging purpose. On the other hand, JRE is not responsible for development purposes so it doesn’t contain such tools as the compiler, debugger, etc. Instead, it contains class libraries and supporting files required for the purpose of execution of the program.
IMPLEMENTATION OF JDK AND JRE JDK = JRE + other development tools. JRE = JVM + other class libraries.

Feeling lost in the vast world of Backend Development? It’s time for a change! Join our Java Backend Development – Live Course and embark on an exciting journey to master backend development efficiently and on schedule. What We Offer:

  • Comprehensive Course
  • Expert Guidance for Efficient Learning
  • Hands-on Experience with Real-world Projects
  • Proven Track Record with 100,000+ Successful Geeks

Last Updated :
22 Feb, 2021

Like Article

Save Article

Share your thoughts in the comments

Please Login to comment…

By Pankaj

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

The difference between JDK, JRE, and JVM is one of the popular interview questions. You might also be asked to explain JDK vs JRE vs JVM.

JDK, JRE, and JVM are core concepts of Java programming language. We don’t use these concepts in programming. But, as a Java developer, we should know about them.

Java Development Kit aka JDK is the core component of Java Environment and provides all the tools, executables, and binaries required to compile, debug, and execute a Java Program. JDK is a platform-specific software and that’s why we have separate installers for Windows, Mac, and Unix systems. We can say that JDK is the superset of JRE since it contains JRE with Java compiler, debugger, and core classes.

JVM is the heart of Java programming language. When we execute a Java program, JVM is responsible for converting the byte code to the machine-specific code. JVM is also platform-dependent and provides core java functions such as memory management, garbage collection, security, etc. JVM is customizable and we can use java options to customize it. For example, allocating minimum and maximum memory to JVM. JVM is called virtual because it provides an interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and the operating system makes java program write-once-run-anywhere.

JRE is the implementation of JVM. It provides a platform to execute java programs. JRE consists of JVM, Java binaries, and other classes to execute any program successfully. JRE doesn’t contain any development tools such as Java compiler, debugger, JShell, etc. If you just want to execute a java program, you can install only JRE. You don’t need JDK because there is no development or compilation of java source code is required. Now that we have a basic understanding of JDK, JVM, and JRE, let’s look into the difference between them.

Let’s look at some of the important differences between JDK, JRE, and JVM.

Sometimes you will find JIT alongside JVM, JDK, and JRE in textbooks. JIT is part of the JVM that optimizes the process of converting byte code to machine-specific language. It compiles similar byte codes at the same time and reduces the overall time taken for the compilation of byte code to machine-specific language.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Below text from this article – JVM is called virtual because it provides an interface that does not depend on the underlying operating system and machine hardware. This independence from hardware and the operating system is what makes java program write-once-run-anywhere. Does JVM provided interface not depend on underlying platform. If that interface (i.e. loding, linking, JIT, interpreter etc) is same for all platforms then why JVMs are different for each platform. I feel this interface which takes byte code as input and gives you end result is platform dependent which makes Java platform independent. May be you can correct my understanding.

– Love Gupta

Thanks a lot!

– Saangram

Please update the version of Java.

– srinivas narla

very well explained,

– Vitthal Kasbe

JVM is also platform dependent under JVM , i hope this is a TYPO.

– Sailendra

I wish to know step by step execution and impacts , functionalties for jdk, jvm (including memory areas )m jre ? I mean i wish to know end-to-end flow when a java program gets executed (specially through various section inside JVM – among those i also wish to know impacts on memory areas (heap,stack, native area ), class loaders e.t.c.

– Bibhu Prasad Tripathy

very good.

– Leandro

Hi Pankaj, Thanks for such useful tutorials. You are doing great. Keep it up. I have some doubt about JIT. You said that it optimizes byte code to machine specific language compilation by compiling similar byte codes at same time. My question is that while converting byte code into machine specific code do all the byte code passes through JIT. Because i have heared that only interpretor also have its role in converting byte code into machine specific code. Or only similar byte codes are passes through JIT and rest all passes through interpreter. It would be very useful if you can elaborate it with some example.

– debu

This is to just let you know that you could update regarding ‘Current JDK Version’ information.

– gansai

I’m confused when I go to Oracles site to download the JDK and they ask if you want JDK for Java EE or JDK for Java SE. What if I want to ability to develop both. Do I really have to install 2 separate JDKs?

– Mike

Click below to sign up and get $200 of credit to try our products over 60 days!

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

What is JVM, JRE, JDK and JIT

Most of the beginners find it difficult to understand the difference between these jargons. In short,

  • Java Virtual Machine (JVM) is an abstract definition of a computing machine.
  • Java Runtime Environment (JRE) is the implementation of the JVM.
  • Java Development Kit (JDK) is a set of tools using which Java programs can be developed and compiled.
  • Just In Time Compiler (JIT) runs on the fly in the execution environment to make optimizations on the program.
JDK, JRE, JVM: What Are They and What Are Their Differences?
JDK, JRE, JVM: What Are They and What Are Their Differences?

Tải và thực thi class files trong JVM

Java class loader trong JVM

Mọi thứ trong java là một lớp(class), và tất cả các ứng dụng Java được xây dựng từ các lớp(classes). Một ứng dụng có thể bao gồm một lớp hoặc hàng ngàn lớp. Để chạy một ứng dụng Java, JVM phải tải các tệp .class đã biên dịch vào context, chẳng hạn như một máy chủ, nơi chúng có thể được truy cập. Một JVM phụ thuộc vào trình tải lớp của nó để thực hiện chức năng này.

Trình tải lớp Java là một phần của JVM tải các lớp vào bộ nhớ và làm cho chúng có sẵn để thực thi. Trình nạp lớp sử dụng các kỹ thuật như lazy-loading và caching để làm cho việc tải lớp hiệu quả nhất có thể.

Công cụ thực thi trong JVM(The execution engine in the JVM)

Khi trình tải lớp đã hoàn thành công việc tải các lớp, JVM bắt đầu thực thi mã trong mỗi lớp. Công cụ thực thi là thành phần JVM xử lý chức năng này. Công cụ thực thi là điều cần thiết cho JVM đang chạy. Mã thực thi liên quan đến việc quản lý truy cập vào tài nguyên hệ thống. Công cụ thực thi JVM nằm giữa chương trình đang chạy – với nhu cầu về tài nguyên tệp, mạng và bộ nhớ – và hệ điều hành, cung cấp các tài nguyên đó.

Cách công cụ thực thi quản lý tài nguyên hệ thống

Tài nguyên hệ thống có thể được chia thành hai loại lớn: bộ nhớ và mọi thứ khác.

Hãy nhớ lại rằng JVM chịu trách nhiệm xử lý bộ nhớ không sử dụng và bộ sưu tập rác(garbage collection) là cơ chế thực hiện việc xử lý đó. JVM cũng chịu trách nhiệm phân bổ và duy trì cấu trúc tham chiếu mà nhà phát triển được cấp. Ví dụ, công cụ thực thi của JVM chịu trách nhiệm lấy một cái gì đó giống như từ khóa new trong Java và biến nó thành một yêu cầu dành riêng cho hệ điều hành để cấp phát bộ nhớ.

Ngoài bộ nhớ, công cụ thực thi quản lý tài nguyên để truy cập hệ thống tệp và network I/O . Do JVM có thể tương tác trên các hệ điều hành, nên đây không phải là nhiệm vụ . Ngoài nhu cầu tài nguyên của từng ứng dụng, công cụ thực thi phải đáp ứng với từng môi trường HĐH.

JRE là gì? Giới thiệu Java Runtime Environment

JRE tạo JVM và đảm bảo các phụ thuộc có sẵn cho các chương trình Java của bạn.

Thực tế mà nói, runtime enviroment là một phần mềm được thiết kế để chạy các phần mềm khác. Là runtime enviroment cho Java, JRE chứa các thư viện lớp Java, trình tải lớp Java và Máy ảo Java. Trong hệ thống này:

  • Trình tải lớp chịu trách nhiệm tải chính xác các lớp và kết nối chúng với các thư viện lớp Java cốt lõi.
  • JVM chịu trách nhiệm đảm bảo các ứng dụng Java có tài nguyên mà chúng cần để chạy và hoạt động tốt trong thiết bị hoặc môi trường đám mây của bạn.
  • JRE chủ yếu là một thùng chứa cho các thành phần khác và chịu trách nhiệm điều phối các hoạt động của chúng.

Tìm hiểu JDK

JDK (là viết tắt của Java Development Kit) bao gồm JRE và các Development Tool.

Trong bài này, chúng ta sẽ tìm hiểu về JVM, JRE, JDK. Nó bao gồm những thành phần nào và nhiệm vụ của nó là gì?

JVM (Java Virtual Machine) là tạo ra môi trường máy ảo để thực thi mã java bytecode.

  • Máy ảo Java là phần mềm giả lập máy tính, nó tập hợp các lệnh logic để xác định hoạt động của máy.
  • Có thể xem nó như là một hệ điều hành thu nhỏ.
  • JVM chuyển mã byte code thành machine code tùy theo môi trường tương ứng (gọi là khả năng khả chuyển)
  • JVM cung cấp môi trường thực thi cho chương trình Java (gọi đó là khả năng độc lập với nền).

JVM có sẵn trong nhiều phần cứng và nền tảng phần mềm.

JVM gồm 4 nhiệm vụ chính: Load code, Verifies code, Executes code, Provides runtime enviroment.

JRE viết tắt Java Runtime Enviromement. Nó bao gồm các thư viện và các file mà JVM sử dụng lúc thực thi.

JDK viết tắt của Java Development Kit. Nó gồm JRE + công cụ phát triển.

Bộ công cụ JDK gồm các chương trình thực thi đáng chú ý sau:

  • javac: Chương trình biên dịch các chương trình nguồn viết bằng ngôn ngữ java ra các tập tin thực thi được trên máy ảo Java.
  • java: Một chương trình để dịch mã mà bạn viết thành mã bytecode, khi ứng dụng Java chạy nó dịch mã bytecode thành mã máy tính và thực thi, điều đó có nghĩa là bytecode chỉ là một mã trung gian.Đây là chương trình làm máy ảo của Java, thông dịch mã Bytecode của các chương trình kiểu application thành mã thực thi của máy thực.
  • Archive (jar): Là một chương trình nén các file thành một file duy nhất có đuôi jar. Thường dùng để đóng gói các file class.
  • Javadoc: Là một công cụ tạo ra tài liệu hướng dẫn sử dụng API.
  • appletviewer: Bộ thông dịch, thực thi các chương trình kiểu applet.
  • javadoc: Tạo tài liệu về chú thích chương trình nguồn một cách tự động.
  • jdb: Trình gở rối.
  • rmic: Tạo Stub cho ứng dụng kiểu RMI.
  • rmiregistry: Phục vụ danh bạ (Name Server) trong hệ thống RMI

Looking for other Java downloads?

JDK 21 is the latest long-term support release of Java SE Platform.

JDK 21 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions (NFTC).

JDK 21 will receive updates under the NFTC, until September 2026, a year after the release of the next LTS. Subsequent JDK 21 updates will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee.

Product/file description File size Download
ARM64 Compressed Archive 186.57 MB
ARM64 RPM Package 186.27 MB
x64 Compressed Archive 188.29 MB
x64 Debian Package 160.09 MB
x64 RPM Package 187.99 MB
Product/file description File size Download
ARM64 Compressed Archive 182.11 MB
ARM64 DMG Installer 181.42 MB
x64 Compressed Archive 184.35 MB
x64 DMG Installer 183.67 MB
Product/file description File size Download
x64 Compressed Archive 185.52 MB
x64 Installer 163.91 MB
x64 MSI Installer 162.07MB

JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the Oracle No-Fee Terms and Conditions (NFTC).

JDK 17 will receive updates under the NFTC, until September 2024. Subsequent JDK 17 updates will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee.

Product/file description File size Download
ARM64 Compressed Archive 172.65 MB
ARM64 RPM Package 172.40 MB
x64 Compressed Archive 174.03 MB
x64 Debian Package 149.43 MB
x64 RPM Package 173.77 MB
Product/file description File size Download
ARM64 Compressed Archive 168.20 MB
ARM64 DMG Installer 167.59 MB
x64 Compressed Archive 170.64 MB
x64 DMG Installer 170.06 MB
Product/file description File size Download
x64 Compressed Archive 172.47 MB
x64 Installer 153.55 MB
x64 MSI Installer 152.34 MB

GraalVM for JDK 21 binaries are free to use in production and free to redistribute, at no cost, under the GraalVM Free Terms and Conditions (GFTC).

GraalVM for JDK 21 will receive updates under the GFTC, until September 2026, a year after the release of the next LTS. Subsequent updates of GraalVM for JDK 21 will be licensed under the GraalVM OTN License Including License for Early Adopter Versions (GOTN) and production use beyond the limited free grants of the GraalVM OTN license will require a fee.

Oracle GraalVM uses the Graal just-in-time compiler and includes the Native Image feature as optional early adopter technology.

Native Image is extensively tested and supported for use in production, but is not a conformant implementation of the Java Platform. GraalVM for JDK 21 without the Native Image feature included is available for customers at My Oracle Support.

Product/file description File size Download
ARM64 Compressed Archive 309.98 MB
x64 Compressed Archive 323.56 MB
Product/file description File size Download
ARM64 Compressed Archive 314.07 MB
x64 Compressed Archive 301.92 MB
Product/file description File size Download
x64 Compressed Archive 310.89 MB

GraalVM for JDK 17 binaries are free to use in production and free to redistribute, at no cost, under the GraalVM Free Terms and Conditions (GFTC).

GraalVM for JDK 17 will receive updates under the GFTC, until September 2024. Subsequent updates of GraalVM for JDK 17 will be licensed under the GraalVM OTN License Including License for Early Adopter Versions (GOTN) and production use beyond the limited free grants of the GraalVM OTN license will require a fee.

Oracle GraalVM uses the Graal just-in-time compiler and includes the Native Image feature as optional early adopter technology.

Native Image is extensively tested and supported for use in production, but is not a conformant implementation of the Java Platform. GraalVM for JDK 17 without the Native Image feature included is available for customers at My Oracle Support.

Product/file description File size Download
ARM64 Compressed Archive 298.41 MB
x64 Compressed Archive 316.92 MB
Product/file description File size Download
ARM64 Compressed Archive 350.37 MB
x64 Compressed Archive 299.12 MB
Product/file description File size Download
x64 Compressed Archive 305.23 MB

Script-friendly Download URLs

The URLs listed above will remain the same for update releases to allow their use in scripts.

Learn more about automating these downloads

Java SE subscribers get support for JDK 17, receive updates until at least October 2029, are entitled to GraalVM, Java Management Service, and bundled patch releases (BPRs) with fixes not yet available to nonsubscribers, and more.

Also available for development, personal use, and to run other licensed Oracle products.

Java SE subscribers will receive JDK 8 updates until at least December 2030.

Manual update required for some Java 8 users on macOS.

The Oracle JDK 8 license changed in April 2019

The Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK 8 licenses. This license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. FAQs are available here.

Commercial license and support are available for a low cost with Java SE Universal Subscription.

JDK 8 software is licensed under the Oracle Technology Network License Agreement for Oracle Java SE.

Java SE 8u401 checksums and OL 8 GPG Keys for RPMs

Product/file description File size Download
ARM64 RPM Package 71.70 MB
ARM64 Compressed Archive 71.88 MB
x86 RPM Package 140.75 MB
x86 Compressed Archive 138.13 MB
x64 RPM Package 137.79 MB
x64 Compressed Archive 135.04 MB
Product/file description File size Download
ARM64 Compressed Archive 119.42 MB
ARM64 DMG Installer 201.35 MB
x64 DMG Installer 208.95 MB
Product/file description File size Download
SPARC 64-bit (SVR4 package) 118.39 MB
SPARC 64-bit Compressed Archive 84.35 MB
x64 (SVR4 package) 119.34 MB
x64 Compressed Archive 82.25 MB
Product/file description File size Download
x86 Installer 139.73 MB
x64 Installer 149.08 MB

Java SE Runtime Environment 8u401

JRE 8 software is licensed under the Oracle Technology Network License Agreement for Oracle Java SE.

Product/file description File size Download
x86 RPM Package 101.03 MB
x86 Compressed Archive 98.40 MB
x64 RPM Package 97.94 MB
x64 Compressed Archive 95.19 MB
Product/file description File size Download
x64 DMG Installer 88.59 MB
x64 Compressed Archive 82.07 MB
ARM64 DMG Installer 84.60 MB
ARM64 Compressed Archive 78.15 MB
Product/file description File size Download
SPARC 64-bit Compressed Archive 53.28 MB
x64 Compressed Archive 51.17 MB
Product/file description File size Download
x86 Online Installer 2.24 MB
x86 Offline Installer 58.41 MB
x86 Compressed Archive 74.66 MB
x64 Installer 64.43 MB
x64 Compressed Archive 81.41 MB

Server JRE (Java SE Runtime Environment) 8u401

Server JRE 8 software is licensed under the Oracle Technology Network License Agreement for Oracle Java SE

Product/file description File size Download
x64 Compressed Archive 52.99 MB
Product/file description File size Download
SPARC 64-bit 65.11 MB
x64 Compressed Archive 63.00 MB
Product/file description File size Download
x64 Installer 51.47 MB

For Java developers. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.

Enterprise Performance Pack brings significant memory and performance improvements including modern garbage collection algorithms, reduced memory usage and many other optimizations.

Server Java Runtime Environment (Server JRE). For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications, but does not include browser integration (Java plug-in), auto-update, or an installer.

Covers most end-users needs. Contains everything required to run Java applications on your system.

Java SE subscribers will receive JDK 11 updates until at least January 2032.

These downloads can be used for development, personal use, or to run Oracle licensed products. Use for other purposes, including production or commercial use, requires a Java SE Universal Subscription or another Oracle license.

Commercial license and support are available for a low cost with Java SE Universal Subscription.

JDK 11 software is licensed under the Oracle Technology Network License Agreement for Oracle Java SE.

JDK 11.0.22 checksums and OL 8 GPG Keys for RPMs

Product/file description File size Download
ARM64 RPM Package 159.36 MB
ARM64 Compressed Archive 159.46 MB
x64 Debian Package 138.39 MB
x64 RPM Package 160.72 MB
x64 Compressed Archive 160.84 MB
Product/file description File size Download
ARM64 Compressed Archive 154.14 MB
ARM64 DMG Installer 153.61 MB
x64 Compressed Archive 156.41 MB
x64 DMG Installer 155.90 MB
Product/file description File size Download
SPARC Compressed Archive 185.25 MB
Product/file description File size Download
x64 Installer 141.43 MB
x64 Compressed Archive 159.18 MB

These downloads can be used for development, personal use, or within Oracle Cloud. Use for other purposes, including production or commercial use, requires a Java SE subscription product.

Commercial license and support are available for a low cost with Java SE Universal Subscription.

Java 8 Enterprise Performance Pack is licensed under the Oracle Technology Network License Agreement for Oracle Java SE.

Java SE 8u401 checksums

Product/file description File size Download
ARM64 RPM Package 53.00 MB
ARM64 Compressed Archive 53.24 MB
x64 RPM Package 55.18 MB
x64 Compressed Archive 57.47 MB

Editors note: This question was asked in 2009 where the world was different. In 2022 the standard open sourced OpenJDK is JDK-only.

What is the difference between JDK and JRE?

What are their roles and when should I use one or the other?

Editors note: This question was asked in 2009 where the world was different. In 2022 the standard open sourced OpenJDK is JDK-only.

What is the difference between JDK and JRE?

What are their roles and when should I use one or the other?

The JRE is the Java Runtime Environment. It is a package of everything necessary to run a compiled Java program, including the Java Virtual Machine (JVM), the Java Class Library, the

java

command, and other infrastructure. However, it cannot be used to create new programs.

The JDK is the Java Development Kit, the full-featured SDK for Java. It has everything the JRE has, but also the compiler (

javac

) and tools (like

javadoc

and

jdb

). It is capable of creating and compiling programs.

Usually, if you only care about running Java programs on computer you will only install the JRE. It’s all you need. On the other hand, if you are planning to do some Java programming, you need to install the JDK instead.

Sometimes, even if you are not planning to do any Java development on a computer, you still need the JDK installed. For example, if you are deploying a web application with JSP, you are technically just running Java programs inside the application server. Why would you need the JDK then? Because the application server will convert JSP into Java servlets and needs to use the JDK to compile the servlets. I am sure that there are more examples.

The answer above (by Pablo) is very right. This is just additional information.

The JRE is, as the name implies, an environment. It’s basically a bunch of directories with Java-related files, to wit:


bin/contains Java's executable programs. The most important is


java(and for Windows,


javawas well), which launches the JVM. There are some other utilities here as well, such as


keytooland


policytool.


conf/holds user-editable configuration files for Java experts to play with.


lib/has a large number of supporting files: some


.jars, configuration files, property files, fonts, translations, certs, etc. – all the "trimmings" of Java. The most important is


modules, a file that contains the


.classfiles of the Java standard library.


.dll(Windows) or


.dylib(macOS) or


.so(Linux) files under


bin/or


lib/with supporting, system-specific native binary code.

The JDK is also a set of directories. It is a superset of the JRE, with some additions:


bin/has been enlarged with development tools. The most important of them is


javac; others include


jar,


javadocand


jshell.


jmods/, which holds JMOD files for the standard library, has been added. These files allow the standard library to be used with


jlink.

JDK is a superset of JRE, and contains everything that is in JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications. JRE provides the libraries, the Java Virtual Machine (JVM), and other components to run applets and applications written in the Java programming language.


/usr/lib/jvm/java-8-openjdk-amd64) and the


javafile inside the bin directory of the JDK is only a shortcut for the "real" java file inside the bin sub-directory of the jre directory. Oct 24, 2023 at 17:25

In layman terms: JDK is grandfather JRE is father and JVM is their son. [i.e. JDK > JRE > JVM ]

JDK = JRE + Development/debugging tools

JRE = JVM + Java Packages Classes(like util, math, lang, awt,swing etc)+runtime libraries.

JVM = Class loader system + runtime data area + Execution Engine.

In other words if you are a Java programmer you will need JDK in your system and this package will include JRE and JVM as well but if you are normal user who like to play online games then you will only need JRE and this package will not have JDK in it.

JVM :

The Java Virtual Machine (JVM) is the virtual machine that run the Java bytecodes. The JVM doesn’t understand Java source code, that’s why you compile your *.java files to obtain *.class files that contain the bytecodes understandable by the JVM. It’s also the entity that allows Java to be a “portable language” (write once, run anywhere). Indeed there are specific implementations of the JVM for different systems (Windows, Linux, MacOS, see the wikipedia list..), the aim is that with the same bytecodes they all give the same results.

JDK and JRE

To explain the difference between JDK and JRE, the best is to read the Oracle documentation and consult the diagram :

Java Runtime Environment (JRE)

The Java Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other components to run applets and applications written in the Java programming language. In addition, two key deployment technologies are part of the JRE: Java Plug-in, which enables applets to run in popular browsers; and Java Web Start, which deploys standalone applications over a network. It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for enterprise software development and deployment. The JRE does not contain tools and utilities such as compilers or debuggers for developing applets and applications.

Java Development Kit (JDK)

The JDK is a superset of the JRE, and contains everything that is in the JRE, plus tools such as the compilers and debuggers necessary for developing applets and applications.

Note that Oracle is not the only one to provide JDK.

JIT Compile Process (Courtesy: Oracle documentation)

One difference from a debugging perspective:

To debug into Java system classes such as String and ArrayList, you need a special version of the JRE which is compiled with “debug information”. The JRE included inside the JDK provides this info, but the regular JRE does not. Regular JRE does not include this info to ensure better performance.

What is debugging information? Here is a quick explanation taken from this blog post:

Modern compilers do a pretty good job converting your high-level code, with its nicely indented and nested control structures and arbitrarily typed variables into a big pile of bits called machine code (or bytecode in case of Java), the sole purpose of which is to run as fast as possible on the target CPU (virtual CPU of your JVM). Java code gets converted into several machine code instructions. Variables are shoved all over the place – into the stack, into registers, or completely optimized away. Structures and objects don’t even exist in the resulting code – they’re merely an abstraction that gets translated to hard-coded offsets into memory buffers.

So how does a debugger know where to stop when you ask it to break at the entry to some function? How does it manage to find what to show you when you ask it for the value of a variable? The answer is – debugging information.

Debugging information is generated by the compiler together with the machine code. It is a representation of the relationship between the executable program and the original source code. This information is encoded into a pre-defined format and stored alongside the machine code. Many such formats were invented over the years for different platforms and executable files.

From Official java website…

JRE (Java Runtime environment):

JDK (Java Development Kit)

JVM, JRE, JDK – these are all the backbone of Java language. Each component work separately. JDK and JRE physically exist but JVM is an abstract machine that means it does not physically exist.

JVM is the subsystem of JDK and JRE which is used to check the intermediate code known as “bytecode”. It first loads the “class file” (having .c extension) generated by the Java compiler (javac) through JVM subsystem classloader and classified memory location (class area, stack, heap and pc registers) according to their use. Then it checks all the bytecode to ensure that it is returned in Java and all memory accessibility access by the network. The interpreter’s work starts after that where it checks the whole program line by line. The results are finally shown in the console/browser/application through JRE (Java Runtime Environment) which runtime facilities.

JRE is also a subsystem of JDK which provides runtime facilities like JVM, classes, executable files like .jar file, etc.

JDK stands for Java Development Kit. It contains all necessary components used in Java programming such as class, method, swing, AWT, package, Java (interpreter), javac (compiler), appletviewer (applet application viewer), etc. To conclude, it contains every file required for developing applications, whether standalone or web-based.

Here’s a simple response directly from Oracle http://docs.oracle.com/javase/7/docs/technotes/guides/

Java SE Runtime Environment (JRE)

The JRE provides the libraries, Java virtual machine, and other components necessary for you to run applets and applications written in the Java programming language. This runtime environment can be redistributed with applications to make them free-standing.

Java SE Development Kit (JDK)

The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

JRE

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM.It physically exists.It contains set of libraries + other files that JVM uses at runtime.

JDK

JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools.

Link :- http://www.javatpoint.com/difference-between-jdk-jre-and-jvm

Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It’s all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.

JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.

Java Virtual Machine (JVM) is a run-time system that executes Java bytecode.

JRE is the environment (standard libraries and JVM) required to run Java applications.

The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM.It physically exists.It contains set of libraries + other files that JVM uses at runtime

JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools

If you want to run Java programs, but not develop them, download the Java Run-time Environment, or JRE. If you want to develop them, download the Java Development kit, or JDK

Let’s called JDK is a kit, which include what are those things need to developed and run java applications.

JDK is given as development environment for building applications, component s and applets.

It contains everything you need to run Java applications in compiled form. You don’t need any libraries and other stuffs. All things you need are compiled.

JRE is can not used for development, only used for run the applications.

If you are a Java programmer you will need JDK in your system and this package will include JRE and JVM as well but if you are normal user who like to play online games then you will only need JRE and this package will not have JDK in it.

JVM

JVM (Java Virtual Machine) is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.

JVMs are available for many hardware and software platforms. JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent.

JRE

It contains everything you need to run Java applications in compiled form. You don’t need any libraries and other stuffs. All things you need are compiled.

JRE is can not used for development, only used for run the applications.

Java SE Development Kit (JDK)

The JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

(Sources: GeeksForGeeks Q&A, Java Platform Overview)

Simply :

JVM is the virtual machine Java code executes on

JRE is the environment (standard libraries and JVM) required to run Java applications

JDK is the JRE with developer tools and documentation

A clear understanding of these terms(JVM, JDK, JRE) are essential to grasp their usage and differences.

JVM Java Virtual Machine (JVM) is a run-time system that executes Java bytecode. The JVM is like a virtual computer that can execute a set of compiled instructions and manipulate memory locations. When a Java compiler compiles source code, it generates a highly optimized set of instructions called bytecode in a .class file. The JVM interprets these bytecode instructions and converts them to machine-specific code for execution.

JDK The Java Development Kit (JDK) is a software development environment that you can use to develop and execute Java applications. It includes the JRE and a set of programming tools, such as a Java compiler, interpreter, appletviewer, and document viewer. The JDK is implemented through the Java SE, Java EE, or Java ME platforms.

JRE The Java Runtime Environment (JRE) is a part of the JDK that includes a JVM, core classes, and several libraries that support application development. Though the JRE is available as part of the JDK, you can also download and use it separately.

For complete understanding you can see my Blog : Jdk Jre Jvm and differences

jdk is necessary to compile to code and convert java code to byte codes while jre is necessary for executing the byte codes.

JDK includes the JRE plus command-line development tools such as compilers and debuggers that are necessary or useful for developing applets and applications.

JRE is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.

JDK is an abstract machine. It is a specification that provides runtime environment in which java bytecode can be executed.

So, Basically JVM < JRE < JDK as per @Jaimin Patel said.

The difference between JDK and JRE is that JDK is the software development kit for java while JRE is the place where you run your programs.

suppose, if you are a developer then your role is to develop program as well as to execute the program. so you must have environment for developing and executing, which is provided by JDK.

suppose, if you are a client then you don’t have to worry about developing.Just you need is, an environment to run program and get result only, which is provided by JRE.

JRE executes the application but JVM reads the instructions line by line so it’s interpreter.

JDK=JRE+Development Tools

JRE=JVM+Library Classes

JRE

JRE is an acronym for Java Runtime Environment.It is used to provide runtime environment.It is the implementation of JVM. It physically exists. It contains set of libraries + other files that JVM uses at runtime.

Implementation of JVMs are also actively released by other companies besides Sun Micro Systems.

JDK

JDK is an acronym for Java Development Kit.It physically exists.It contains JRE + development tools.

Difference between JDK, JRE, and JVM

We must understand the differences between JDK, JRE, and JVM before proceeding further to Java. See the brief overview of JVM here.

If you want to get the detailed knowledge of Java Virtual Machine, move to the next page. Firstly, let’s see the differences between the JDK, JRE, and JVM.

JVM

JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn’t physically exist. It is a specification that provides a runtime environment in which Java bytecode can be executed. It can also run those programs which are written in other languages and compiled to Java bytecode.

JVMs are available for many hardware and software platforms. JVM, JRE, and JDK are platform dependent because the configuration of each OS is different from each other. However, Java is platform independent. There are three notions of the JVM: specification, implementation, and instance.

The JVM performs the following main tasks:

JRE

JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. The Java Runtime Environment is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. It is the implementation of JVM. It physically exists. It contains a set of libraries + other files that JVM uses at runtime.

The implementation of JVM is also actively released by other companies besides Sun Micro Systems.

JDK

JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment which is used to develop Java applications and applets. It physically exists. It contains JRE + development tools.

JDK is an implementation of any one of the below given Java Platforms released by Oracle Corporation:

The JDK contains a private Java Virtual Machine (JVM) and a few other resources such as an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), etc. to complete the development of a Java Application.

More Details.

Reference Video

Next TopicJVM: Java Virtual Machine

Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), and other tools needed in Java development.

Now we need an environment to make a run of our program. Henceforth, JRE stands for “Java Runtime Environment” and may also be written as “Java RTE.” The Java Runtime Environment provides the minimum requirements for executing a Java application; it consists of the Java Virtual Machine (JVM), core classes, and supporting files.

Now let us discuss JVM, which stands out for java virtual machines. It is as follows:

  • A specification where the working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Sun and other companies.
  • An implementation is a computer program that meets the requirements of the JVM specification.
  • Runtime Instance Whenever you write a java command on the command prompt to run the java class, an instance of JVM is created.

Before proceeding to the differences between JDK, JRE, and JVM, let us discuss them in brief first and interrelate them with the image below proposed.

Don’t get confused as we are going to discuss all of them one by one.

1. JDK (Java Development Kit) is a Kit that provides the environment to develop and execute(run) the Java program. JDK is a kit(or package) that includes two things

  • Development Tools(to provide an environment to develop your java programs)
  • JRE (to execute your java program).

2. JRE (Java Runtime Environment) is an installation package that provides an environment to only run(not develop) the java program(or application)onto your machine. JRE is only used by those who only want to run Java programs that are end-users of your system.

3. JVM (Java Virtual Machine) is a very important part of both JDK and JRE because it is contained or inbuilt in both. Whatever Java program you run using JRE or JDK goes into JVM and JVM is responsible for executing the java program line by line, hence it is also known as an interpreter.

Now let us discuss the components of JRE in order to understand its importance of it and perceive how it actually works. For this let us discuss components.

The components of JRE are as follows:

  1. Deployment technologies, including deployment, Java Web Start, and Java Plug-in.
  2. User interface toolkits, including Abstract Window Toolkit (AWT), Swing, Java 2D, Accessibility, Image I/O, Print Service, Sound, drag, and drop (DnD), and input methods.
  3. Integration libraries, including Interface Definition Language (IDL), Java Database Connectivity (JDBC), Java Naming and Directory Interface (JNDI), Remote Method Invocation (RMI), Remote Method Invocation Over Internet Inter-Orb Protocol (RMI-IIOP), and scripting.
  4. Other base libraries, including international support, input/output (I/O), extension mechanism, Beans, Java Management Extensions (JMX), Java Native Interface (JNI), Math, Networking, Override Mechanism, Security, Serialization, and Java for XML Processing (XML JAXP).
  5. Lang and util base libraries, including lang and util, management, versioning, zip, instrument, reflection, Collections, Concurrency Utilities, Java Archive (JAR), Logging, Preferences API, Ref Objects, and Regular Expressions.
  6. Java Virtual Machine (JVM), including Java HotSpot Client and Server Virtual Machines.

After having an adequate understanding of the components, now let us discuss the working of JDK. In order to understand how JDK works, let us consider an illustration below as follows:

Illustration:

Consider a java source file saved as ‘Example.java’. The file is compiled into a set of Byte Code that is stored in a “.class” file. Here it will be “Example.class“.

Note: From above, media operation computing during the compile time can be interpreted.The following actions occur at runtime as listed below:

  • Class Loader
  • Byte Code Verifier
  • Interpreter

    • Execute the Byte Code
    • Make appropriate calls to the underlying hardware

Now let us discuss in brief how JVM works out. It is as follows:

JVM becomes an instance of JRE at the runtime of a Java program. It is widely known as a runtime interpreter.JVM largely helps in the abstraction of inner implementation from the programmers who make use of libraries for their programs from JDK.

It is mainly responsible for three activities.

  • Loading
  • Linking
  • Initialization

Similarly, now let us discuss the working of JRE which is as follows:

  • JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls the main method present in a java code. JVM is a part of JRE(Java Runtime Environment).
  • Java applications are called WORA (Write Once Run Anywhere). This means a programmer can develop Java code on one system and can expect it to run on any other Java-enabled system without any adjustments. This is all possible because of JVM.
  • When we compile a .java file, .class files(contains byte-code) with the same class names present in .java file are generated by the Java compiler. This .class file goes into various steps when we run it. These steps together describe the whole JVM.

Feeling lost in the vast world of Backend Development? It’s time for a change! Join our Java Backend Development – Live Course and embark on an exciting journey to master backend development efficiently and on schedule. What We Offer:

  • Comprehensive Course
  • Expert Guidance for Efficient Learning
  • Hands-on Experience with Real-world Projects
  • Proven Track Record with 100,000+ Successful Geeks

Last Updated :
03 Oct, 2022

Like Article

Save Article

Share your thoughts in the comments

Please Login to comment…

JDK là gì? JDK và JRE khác nhau chỗ nào

Bài đăng này đã không được cập nhật trong 4 năm

Để có thể tự học lập trình dễ dàng thì bạn không thể bỏ qua khái niệm JDK. Tìm hiểu sơ qua về JDK nhé các bạn. JRE, JDK, Java khác nhau chỗ nào? JDK là dùng cho mục đích phát triển (lập trình, debug), nếu bạn chỉ cần chạy chương trình Java thì không nhất thiết phải cài JDK mà chỉ cần cài JRE.

JDK vs JRE: ¿qué diferencia hay?
JDK vs JRE: ¿qué diferencia hay?

Java Virtual Machine (JVM)

JVM is an abstract computing machine used to implement Java language. JVM is the key component in the Java eco system. Java’s important property is platform independence and to achieve that the role of JVM is critical. The JVM sits on top of the hardware and is used to execute the Java programs. Input for the JVM is Java byte code and it interprets the instructions in the byte code thus executing the programs.

Bộ nhớ Java và JRE

Bộ nhớ Java bao gồm ba thành phần: heap, stack và metaspace (trước đây được gọi là permgen).

  • Metaspace là nơi Java giữ thông tin không thay đổi của chương trình như các định nghĩa lớp.
  • Không gian heap (Heap space) là nơi Java giữ nội dung biến(variable content).
  • Không gian ngăn xếp (Stack space) là nơi Java lưu trữ thực thi hàm(function execution) và tham chiếu biến(variable references).
JRE vs. JDK
JRE vs. JDK

What is JDK?

JDK stands for Java Development Kit. It is a complete software environment for building applications using Java language. It contains a collection of tools and utilities which are very essential for a developer for writing, compiling, and debugging. The JDK is platform-dependent and because of this reason, it has different OS platform versions for Windows, Linux, Mac, and so on.

The JDK contains the Java Runtime Environment (JRE), which provides the Java Virtual Machine (JVM) for executing Java code. The JDK also contains the Java compiler, which converts our Java source code into Java bytecode that can be executed on any machine that has a compatible JVM in it. The JDK also offers a variety of tools for debugging, testing, and monitoring our Java applications.

Below listed are the features of JDK:

  • JDK provides an environment for writing and running Java source code.
  • JDK provides all the functionalities of JRE and JVM.
  • JDK enables developers in handling exceptions smoothly by integrating many extensions together into a single catch block.
  • It also provides a debugger, compiler, and other development tools.

FAQs Related to the Difference Between JDK, JRE, JVM

Here are some frequently asked questions related to the differences between JDK, JRE, and JVM.

1. Is the JRE required to run Java applications?Yes, the JRE is required to run Java applications. When you run a Java application, the JRE provides a runtime environment that includes the JVM and a set of libraries and utilities required for executing the application.

2. Can I run Java applications without installing the JDK?Yes, you can run Java applications by installing the JRE (Java Runtime Environment). However, if you want to develop Java applications, you’ll need the JDK as it includes the JRE along with additional development tools.

3. How does the JVM facilitate platform independence in Java?The JVM interprets the Java bytecode generated by the Java compiler. It abstracts the underlying hardware and operating system, allowing Java programs to run on any device or platform that has a compatible JVM installed, thus ensuring platform independence.

4. Are there different versions of JDK, JRE, and JVM available?Yes, Oracle, as well as other organizations and communities, release different versions of JDK, JRE, and JVM. These versions often include updates, enhancements, and bug fixes to improve performance and security.

5. Is the JDK required on a system where only JRE is needed for running Java applications?If you only intend to run Java applications and not develop them, installing the JRE suffices. The JDK, which includes the JRE, is necessary only for development purposes.

JVM, JDK, JRE: Có gì khác biệt giữa chúng?

Bài đăng này đã không được cập nhật trong 4 năm

Ba thành phần nền tảng Java không thể thiếu và cách chúng hoạt động cùng nhau trong các ứng dụng Java của bạn

Các nhà phát triển mới sử dụng Java thường tự hỏi có gì khác biệt Java Virtual Machine, Java Development Kit, Java Runtime Environment. Họ cũng tò mò về cách ba thành phần nền tảng Java này hoạt động cùng nhau trong các ứng dụng Java. Cuối cùng, các nhà phát triển cần biết họ sẽ tương tác với từng thành phần như thế nào.

Nói ngắn gọn:

  • JVM là thành phần nền tảng Java thực thi các chương trình của bạn.
  • JRE khởi tạo JVM và đảm bảo các phụ thuộc có sẵn cho các chương trình của bạn.
  • JDK cho phép bạn tạo các chương trình Java có thể được thực thi và chạy bởi JVM và JRE.

Là nhà phát triển, bạn sẽ làm việc với JDK để viết các ứng dụng của mình và với JVM để gỡ lỗi và tối ưu hóa chúng, đặc biệt là về hiệu năng. JRE chủ yếu chạy ở chế độ nền, nhưng bạn có thể sử dụng nó để theo dõi ứng dụng và cấu hình bộ nhớ.

JVM là gi? Giới thiệu Java Virtual Machine

JVM quản lý bộ nhớ hệ thống và cung cấp môi trường thực thi di động cho các ứng dụng dựa trên Java

Java с нуля. JDK vs JRE vs JVM
Java с нуля. JDK vs JRE vs JVM

Quản lí bộ nhớ trong JVM

Tương tác phổ biến nhất với JVM đang chạy là kiểm tra mức sử dụng bộ nhớ trong heap và stack. Điều chỉnh phổ biến nhất là điều chỉnh các cài đặt bộ nhớ của JVM.

Thu gom rác(Garbage collection)

Trước Java, tất cả bộ nhớ chương trình được quản lý bởi lập trình viên. Trong Java, bộ nhớ chương trình được quản lý bởi JVM. JVM quản lý bộ nhớ thông qua một quá trình gọi là bộ sưu tập rác(garbage collection), liên tục xác định và loại bỏ bộ nhớ không sử dụng trong các chương trình Java. Việc thu gom rác xảy ra bên trong một JVM đang chạy.

Java Development Kit (JDK)

Java JDK is the software bundle using which the Java applications can be developed. JDK’s main component is the Java compiler using which the Java source code is compiled to byte code. Along with the Java compiler it contains more tools like Jar, JConsole, Javaw, etc. These help tools help in various different aspects of developing a Java application. The JDK bundle can be downloaded from the above given link in Oracle’s website.

How to Install Java JRE (Java Runtime Environment) on Windows 10
How to Install Java JRE (Java Runtime Environment) on Windows 10

Keywords searched by users: java jdk and jre

Difference Between Jdk And Jre In Java - Geeksforgeeks
Difference Between Jdk And Jre In Java – Geeksforgeeks
What Is Jdk, Jre And Jvm In Java - Explained With Diagrams
What Is Jdk, Jre And Jvm In Java – Explained With Diagrams
Difference Between Jdk, Jre And Jvm - Javatpoint
Difference Between Jdk, Jre And Jvm – Javatpoint
Jdk Là Gì? Jdk Và Jre Khác Nhau Chỗ Nào | Devmaster
Jdk Là Gì? Jdk Và Jre Khác Nhau Chỗ Nào | Devmaster
Jdk Vs Jre Vs Jvm In Java - What'S The Difference ? - Simple Snippets
Jdk Vs Jre Vs Jvm In Java – What’S The Difference ? – Simple Snippets
Java Jdk, Jre And Jvm
Java Jdk, Jre And Jvm
Java Essentials - Java Jvm,Jre And Jdk - Youtube
Java Essentials – Java Jvm,Jre And Jdk – Youtube
Difference Between Jdk, Jre, And Jvm - Shiksha Online
Difference Between Jdk, Jre, And Jvm – Shiksha Online
Jdk Vs Jre Vs Jvm In Java – Difference Between Them
Jdk Vs Jre Vs Jvm In Java – Difference Between Them
Jdk In Java - Geeksforgeeks
Jdk In Java – Geeksforgeeks
Jdk, Jre, And Jvm - Java Training School
Jdk, Jre, And Jvm – Java Training School
Jdk Vs Jre Vs Jvm: Difference Between Them - Beginnersbook
Jdk Vs Jre Vs Jvm: Difference Between Them – Beginnersbook
Differences Between Jdk, Jre, And Jvm?
Differences Between Jdk, Jre, And Jvm?
Introduction To Jvm, Jdk, Jre - Java Programming Basics
Introduction To Jvm, Jdk, Jre – Java Programming Basics
Jdk Vs Jre Vs Jvm - Java Beginners Tutorial
Jdk Vs Jre Vs Jvm – Java Beginners Tutorial
Difference Between Jdk And Jre In Java - Geeksforgeeks
Difference Between Jdk And Jre In Java – Geeksforgeeks
What Is Difference Between Jdk, Jre And Jvm? - Quora
What Is Difference Between Jdk, Jre And Jvm? – Quora
Understanding Jdk, Jre And Jvm
Understanding Jdk, Jre And Jvm
Difference Between Jdk, Jre And Jvm - Javatpoint
Difference Between Jdk, Jre And Jvm – Javatpoint
Difference Between Jdk, Jre, And Jvm - Shiksha Online
Difference Between Jdk, Jre, And Jvm – Shiksha Online
What Is The Jdk? Introduction To The Java Development Kit | Infoworld
What Is The Jdk? Introduction To The Java Development Kit | Infoworld
Java World: Jdk Jre Jvm
Java World: Jdk Jre Jvm
Jvm Vs. Jre Vs. Jdk: What'S The Difference? - Ibm Blog
Jvm Vs. Jre Vs. Jdk: What’S The Difference? – Ibm Blog
Understanding Jvm, Jdk And Jre | Studytonight
Understanding Jvm, Jdk And Jre | Studytonight

See more here: kientrucannam.vn

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *