Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

java - JDK和JRE有什么区别?(What is the difference between JDK and JRE?)

What is the difference between JDK and JRE?

(JDK和JRE有什么区别?)

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

(它们的作用是什么,何时应使用其中一个?)

  ask by i2ijeya translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The JRE is the Java Runtime Environment .

(JREJava运行时环境 。)

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.

(它是运行已编译的Java程序所需的所有程序的包,包括Java虚拟机(JVM),Java类库, java命令和其他基础结构。)

However, it cannot be used to create new programs.

(但是,它不能用于创建新程序。)

The JDK is the Java Development Kit , the full-featured SDK for Java.

(JDKJava Development Kit ,这是Java的全功能SDK。)

It has everything the JRE has, but also the compiler ( javac ) and tools (like javadoc and jdb ).

(它具有JRE拥有的所有内容,还具有编译器( javac )和工具(如javadocjdb )。)

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.

(通常,如果只关心在计算机上运行Java程序,则只会安装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。)

Sometimes, even if you are not planning to do any Java development on a computer, you still need the JDK installed.

(有时,即使您不打算在计算机上进行任何Java开发,也仍然需要安装JDK。)

For example, if you are deploying a web application with JSP, you are technically just running Java programs inside the application server.

(例如,如果要使用JSP部署Web应用程序,则从技术上讲,您只是在应用程序服务器内部运行Java程序。)

Why would you need the JDK then?

(那为什么还要JDK呢?)

Because the application server will convert JSP into Java servlets and needs to use the JDK to compile the servlets.

(因为应用服务器会将JSP转换为Java servlet,并且需要使用JDK来编译servlet。)

I am sure there are be more examples.

(我相信还有更多的例子。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...