gpt4 book ai didi

java - Linux 和 Windows java 编译器生成相同还是不同的类文件?

转载 作者:IT王子 更新时间:2023-10-29 01:23:06 26 4
gpt4 key购买 nike

我们在 Linux 和 Windows 上都有相同版本 1.6.0_25 的 Java 编译。

由于某种原因,生成的类文件不同。是否正确?

最佳答案

Java 编译器是不确定的,如果在同一平台上多次编译或在不同平台上编译,可能不会生成相同的 .class。我试图弄清楚 Java 编译器的内部结构,看看为什么它不是确定性的。

在了解 javac 中的交叉编译选项的同时进一步搜索它可以提供更多见解:

交叉编译选项

By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.

关于java - Linux 和 Windows java 编译器生成相同还是不同的类文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19120985/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com