简体   繁体   English

可以从 Java SE for WINdows 中包含的 src.zip 编译 jdk

[英]can in compile the jdk from the src.zip included in the Java SE for WIndows

I wish to compile the JDK for a custom CPU.我希望为自定义 CPU 编译 JDK。 As far as I know, src.zip is made available with the Oracle Java SE 1.3 package.据我所知,src.zip 随 Oracle Java SE 1.3 包一起提供。

Can I compile JDK 1.3 (for eg.) using the src.zip?我可以使用 src.zip 编译 JDK 1.3(例如)吗? Can I do this in a regular Eclipse/Netbeans project?我可以在常规 Eclipse/Netbeans 项目中执行此操作吗?

Can I compile the Java SE 1.3 from the src.zip included in the Java SE for Windows.我可以从 Java SE for Windows 中包含的 src.zip 编译 Java SE 1.3。

No you can't.不,你不能。

The src.zip file only includes the public classes in the java.* packages. src.zip 文件仅包含java.*包中的公共类。 (And possibly some of the javax.* packages.) AFAIK, it doesn't include the com.sun packages, and others that comprise internal APIs. (可能还有一些javax.*包。)AFAIK,它不包括com.sun包,以及其他包含内部 API 的包。 And it certainly doesn't include the Java source code for the JDK tool chain;它当然不包括 JDK 工具链的 Java 源代码; eg the Java compiler, the javadoc tool and so on.例如 Java 编译器、javadoc 工具等等。

One way to see what is missing would be to compare the contents of src.zip with the compiled zip and jar files in the JRE install.查看缺少什么的一种方法是将src.zip的内容与 JRE 安装中已编译的 zip 和 jar 文件进行比较。

And the src.zip doesn't include any of the native code implementation of the JVM; src.zip不包含任何 JVM 的本机代码实现; eg the JIT compiler, the garbage collector, the native libraries for threads, i/o, and so on.例如,JIT 编译器、垃圾收集器、线程的本地库、I/O 等。


The complete source code for Java SE 1.3 was only available to 3rd-party Java vendors under a special license. Java SE 1.3 的完整源代码仅在特殊许可下提供给第 3 方 Java 供应商。 AFAIK, the license fee was substantial. AFAIK,许可费很高。 Java 1.3 was never released as open source. Java 1.3 从未作为开源发布。

If you want something that you could consider porting Java to a custom CPU, you would need to start with OpenJDK.如果您想要一些可以考虑将 Java 移植到自定义 CPU 的东西,则需要从 OpenJDK 开始。 But it will not be simply a matter of recompiling Java code.但这不仅仅是重新编译 Java 代码的问题。

As already answered, having just 'src.zip' is not enough for JDK build.正如已经回答的那样,对于 JDK 构建来说,只有“src.zip”是不够的。

Building JDK from source is actually complicated process, you'll need to install native C++ compiler and some build tools: http://cr.openjdk.java.net/~ihse/demo-new-build-readme/common/doc/building.html从源代码构建JDK实际上是一个复杂的过程,您需要安装本地C++编译器和一些构建工具: http : //cr.openjdk.java.net/~ihse/demo-new-build-readme/common/doc/建筑.html

So answer for second part:所以回答第二部分:

Can I do this in a regular Eclipse/Netbeans project?我可以在常规 Eclipse/Netbeans 项目中执行此操作吗?

is also no.也是没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM