Is it possible to compile java using Oracle JDK and run the code on OpenJDK?

So, is it possible to all develop a Java daemon (Apache Daemon) on a computer running Windows 7, and then install the service on an Ubuntu server (you still need to look for how to do this) in which OpenJDK is installed?

If so, how can I determine compatible versions of Java on both systems? I mean, if I use Java 1.6 on windows, which version with the minimum OpenJDK compatibility that I should have on an Ubuntu server?

+6
source share
4 answers

Basically, yes, but for corner cases it depends and should be carefully checked at a stage that closely matches the production configuration.

Here are examples of compiler crashes and test crashes that occur in OpenJDK, while the same source snapshot is green when building the Oracle JDK:

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

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

+6
source

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

+3
source

No, it is not, but you have nothing to worry about. Java is a standardized platform, you should be able to compile and run any implementation of it. As long as you keep this version. Java 7 software will not fully run on a Java 6 installation. Java 6 software really works on a Java 7 installation though.

0
source

If you 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 OpenJDK, you will most likely see minor differences in build versions.

Both JVMs comply with the JLS specification, and IMHO are practically reference versions. OpenJDK is an open standard, and HotSpot is widely used as a commercial standard. Issues are almost the same.

You can install the same version of Hotspot on Ubuntu if it is really dangerous.

0
source

Source: https://habr.com/ru/post/921193/


All Articles