JDK和JRE有什么区别? [英] What is the difference between JDK and JRE?

查看:298
本文介绍了JDK和JRE有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JDK和JRE有什么区别?

他们的角色是什么,我应该在何时使用其中一个?

What is the difference between JDK and JRE?
What are their roles and when should I use one or the other?

推荐答案

JRE Java运行时环境。它是运行已编译Java程序所需的所有内容的包,包括Java虚拟机(JVM),Java类库, java 命令和其他基础结构。但是,它不能用于创建新程序。

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.

JDK Java Development Kit ,完整-featured SDK for Java。它拥有JRE所拥有的一切,还有编译器( javac )和工具(如 javadoc JDB )。它能够创建和编译程序。

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.

通常,如果你只关心在计算机上运行Java程序,你只会安装JRE。这就是你所需要的一切。另一方面,如果您计划进行一些Java编程,则需要安装JDK。

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.

有时,即使您不打算在计算机上进行任何Java开发,仍然需要安装JDK。例如,如果要使用JSP部署Web应用程序,那么从技术上讲,您只是在应用程序服务器中运行Java程序。那你为什么需要JDK呢?因为应用程序服务器会将JSP转换为Java servlet,并且需要使用JDK来编译servlet。我相信还有更多的例子。

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 there are be more examples.

这篇关于JDK和JRE有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆