java JDK 文件夹中的类文件在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/459268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 12:28:49  来源:igfitidea点击:

Where are the class files located in JDK folder?

javajdk1.5

提问by Vicky

This may sound like a stupid question. Where are the core class files from Sun, like Button.class, located in the JDK installation folder C:\Program Files\Java\jdk1.5.0_12?

这听起来像是一个愚蠢的问题。Sun 的核心类文件(例如Button.class)位于 JDK 安装文件夹中的C:\Program Files\Java\jdk1.5.0_12什么位置?

Or do the class files reside in C:\Program Files\Java\jre1.5.0_12folder?

或者类文件是否驻留在C:\Program Files\Java\jre1.5.0_12文件夹中?

回答by Cheese Daneish

They are spread between several jars. It looks like Button is in jre/lib/rt.jar though.

它们分布在几个罐子之间。不过看起来 Button 在 jre/lib/rt.jar 中。

回答by Uri

The class files actually reside as jar files inside the Java distribution being used. Most files are in rt.jar (runtime).

类文件实际上作为 jar 文件驻留在所使用的 Java 发行版中。大多数文件都在 rt.jar(运行时)中。

Most developer machines actually have two forms of Java installed. The JDK (which you would often be using when developing and includes the compiler), and the JRE which is used by downloaded Java based applications, and often your web browser. Those are typically two independent distributions that don't know about each other. So the answer to your question is unfortunately, "depending what it is that you are running". To make things worse, the JDK may include it's own copy of the JRE...

大多数开发人员机器实际上安装了两种形式的 Java。JDK(您在开发时经常使用它并包括编译器),以及下载的基于 Java 的应用程序使用的 JRE,通常还有您的 Web 浏览器。这些通常是两个相互不了解的独立分布。因此,不幸的是,您的问题的答案是“取决于您正在运行的是什么”。更糟糕的是,JDK 可能包含它自己的 JRE 副本......

This is one of the sources of the so-called classpath hell, because it is not always clear what you are using when you are running a java program.

这就是所谓的类路径地狱的来源之一,因为在运行 java 程序时并不总是清楚自己在使用什么。

If you run java from the command line, you can sometimes detect the exact version being used.

如果从命令行运行 java,有时可以检测到正在使用的确切版本。

If you use Eclipse, you can pick version of the JDK you are working with.

如果您使用 Eclipse,您可以选择您正在使用的 JDK 版本。

回答by OscarRyz

On Both.

双方。

They are two different JVM's installations. One used to compile ( JDK stands for Java Development Kit ) and the other is the java environment which most customers machine have ( JRE stands for Java Runtime Environment )

它们是两种不同的 JVM 安装。一个用于编译(JDK代表Java Development Kit),另一个是大多数客户机器拥有的java环境(JRE代表Java Runtime Environment)

Look on any of those two for a file named:

在这两个文件中查找名为:

rt.jar

That where the core of the platform resides.

平台的核心所在。

回答by ramasamyz

You can check out yourself for any class through reflection.

您可以通过反思检查自己是否参加了任何课程。

For example where can I find my String class located in the classpath? Easy

例如,我在哪里可以找到位于类路径中的 String 类?简单

URL url = String.class.getResource("String.class");
System.out.println(url);