是否可以使用Oracle JDK编译java并在OpenJDK上运行代码?

时间:2022-07-17 07:01:37

So is it possible to do all the development of a Java daemon (Apache Daemon) on a Windows 7 machine, then install the service on Ubuntu server (still have to search how to do that) which has OpenJDK installed ?

那么是否有可能在Windows 7机器上进行Java守护进程(Apache Daemon)的所有开发,然后在安装了OpenJDK的Ubuntu服务器上安装服务(仍然需要搜索如何操作)?

If yes, how can I identify the compatible versions of Java on both systems ? I mean if I'm using Java 1.6 on windows, what is the least compatible OpenJDK version I should have on Ubuntu server ?

如果是,我如何在两个系统上识别兼容的Java版本?我的意思是如果我在Windows上使用Java 1.6,那么在Ubuntu服务器上应该具有的兼容性最差的OpenJDK版本是什么?

4 个解决方案

#1


6  

Mostly yes, but for corner cases it depends and should be carefully tested on stage that match closely to production configuration.

大多数情况下是的,但对于极端情况,它取决于并且应该在与生产配置密切匹配的舞台上进行仔细测试。

Here are examples of compiler crash and test failure that occurs on OpenJDK, while the same snapshot of sources are green when build by Oracle JDK:

以下是OpenJDK上发生的编译器崩溃和测试失败的示例,而在Oracle JDK构建时,源的相同快照为绿色:

http://travis-ci.org/#!/plokhotnyuk/actors/builds/1948184

http://travis-ci.org/#!/plokhotnyuk/calculator/builds/1948194

#2


3  

Java byte code is portable and can be executed using any JVM that has same or newer version.

Java字节代码是可移植的,可以使用具有相同或更新版本的任何JVM来执行。

#3


0  

No, that's not but you have nothing to worry about this.Java is a standardized platform, you should be able to compile and run on any implementation of it. Just as long as you keep the version in mind. Java 7 software is not going to run on a Java 6 installation completely. Java 6 software does work on a Java 7 installation completely though.

不,那不是,但你没有什么可担心的.Java是一个标准化的平台,你应该能够编译并运行它的任何实现。只要你记住这个版本。 Java 7软件不会完全在Java 6安装上运行。 Java 6软件完全适用于Java 7安装。

#4


0  

If you have compiled for Java 1.6, you need at least OpenJDK 1.6. There are rare cases where Hotspot and OpenJDK are different but since Hotspot is based on the OpenJDK you are more likely to see minor differences in build versions.

如果您已经为Java 1.6编译,那么至少需要OpenJDK 1.6。在极少数情况下,Hotspot和OpenJDK不同,但由于Hotspot基于OpenJDK,因此您更有可能看到构建版本的细微差别。

Both JVMs comply with the JLS spec and IMHO are practically reference implementations. The OpenJDK is the open standard and a HotSpot is widely used as the commercial standard. The releases are almost exactly the same.

两个JVM都符合JLS规范,IMHO实际上是参考实现。 OpenJDK是开放标准,HotSpot被广泛用作商业标准。这些版本几乎完全相同。

You can install the same version of Hotspot on Ubuntu if this is a real concern.

如果这是一个真正的问题,您可以在Ubuntu上安装相同版本的Hotspot。

#1


6  

Mostly yes, but for corner cases it depends and should be carefully tested on stage that match closely to production configuration.

大多数情况下是的,但对于极端情况,它取决于并且应该在与生产配置密切匹配的舞台上进行仔细测试。

Here are examples of compiler crash and test failure that occurs on OpenJDK, while the same snapshot of sources are green when build by Oracle JDK:

以下是OpenJDK上发生的编译器崩溃和测试失败的示例,而在Oracle JDK构建时,源的相同快照为绿色:

http://travis-ci.org/#!/plokhotnyuk/actors/builds/1948184

http://travis-ci.org/#!/plokhotnyuk/calculator/builds/1948194

#2


3  

Java byte code is portable and can be executed using any JVM that has same or newer version.

Java字节代码是可移植的,可以使用具有相同或更新版本的任何JVM来执行。

#3


0  

No, that's not but you have nothing to worry about this.Java is a standardized platform, you should be able to compile and run on any implementation of it. Just as long as you keep the version in mind. Java 7 software is not going to run on a Java 6 installation completely. Java 6 software does work on a Java 7 installation completely though.

不,那不是,但你没有什么可担心的.Java是一个标准化的平台,你应该能够编译并运行它的任何实现。只要你记住这个版本。 Java 7软件不会完全在Java 6安装上运行。 Java 6软件完全适用于Java 7安装。

#4


0  

If you have compiled for Java 1.6, you need at least OpenJDK 1.6. There are rare cases where Hotspot and OpenJDK are different but since Hotspot is based on the OpenJDK you are more likely to see minor differences in build versions.

如果您已经为Java 1.6编译,那么至少需要OpenJDK 1.6。在极少数情况下,Hotspot和OpenJDK不同,但由于Hotspot基于OpenJDK,因此您更有可能看到构建版本的细微差别。

Both JVMs comply with the JLS spec and IMHO are practically reference implementations. The OpenJDK is the open standard and a HotSpot is widely used as the commercial standard. The releases are almost exactly the same.

两个JVM都符合JLS规范,IMHO实际上是参考实现。 OpenJDK是开放标准,HotSpot被广泛用作商业标准。这些版本几乎完全相同。

You can install the same version of Hotspot on Ubuntu if this is a real concern.

如果这是一个真正的问题,您可以在Ubuntu上安装相同版本的Hotspot。