Migrate from Oracle JDK to OpenJDK - java

Migrate from Oracle JDK to OpenJDK.
My services installed OracleJDK package version:
1.
java version "1.6.0_45" Java(TM) SE Runtime Environment (build
1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
2.
java version "1.8.0_151" Java(TM) SE Runtime Environment (build
1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
3.
java version "1.7.0_67" Java(TM) SE Runtime Environment (build
1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
What are OpenJDK versions same with each my OracleJDK version?
Please help me

I'm not sure that this is going to help, but the OpenJDK version numbers match the Oracle JDK version numbers.
The problems are:
Where do you find a downloadable build of OpenJDK for a particular version and hardware platform.
(For Linux and similar) how do you map the OpenJDK version to a package or set of packages for your preferred distro.
Certainly, you are unlikely to find Java 6 or Java 7 packages for recent releases of Linux in the standard package repo's. (Recent versions of Fedora, for example, only have Java 8 and later.) When Oracle stopped public support for Java 6 and Java 7, the OpenJDK-based packages were deprecated.
However, if the builds exist you should be able to find them based on the information in the following OpenJDK page:
How to download and install prebuilt OpenJDK packages
If you cannot find packages, and if you are willing to put in the necessary effort, it should be possible to download the relevant OpenJDK sources and create your own builds.
But my advice would be to upgrade your Java platform to Java 8, with a view to upgrading to Java 11 soon. If you can't afford the effort and (potential) risk of upgrading, then you would be advised to pay for a Java support contract.

Related

How to Verify which openjdk distribution vendor on RHEL RedHatLinux machine?

On checking with java -version get the output as
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
Wants to ensure this openjdk binary is from oracle or redhat.
While checking on JMX VM Summary page it shows the Vendor name as "Oracle Corporation". Does this mean its oracle provided openjdk distribution ?
What should be the vendor name for RedHat OpenJDK distribution ?
In general, java -version from Oracle's builds say
java version ...
Instead of
openjdk version ....
The java.vendor system property, unfortunately, has compatibility issues. It can't be changed without (potentially) breaking users.
For example, changing that property from Sun to Oracle once broke eclipse: https://it.slashdot.org/story/10/07/28/2121259/oracles-java-company-change-breaks-eclipse
So OpenJDK distributors are very very cautious about changing these vendor properties. Pretty much everyone will stick to the default values for pretty much all the system properties.
If you have installed OpenJDK on RHEL and you are using the java-*-openjdk packages, those have been built and are being maintained by Red Hat. You can find out what package that is by using rpm:
rpm -qf $(readlink -f $(which java))
If you see java-1.8.0-openjdk-headless, that's the package maintained by Red Hat.
openjdk is from oracle. i think the redhat just put binaries of openjdk in their repository. so the vendorname is oracle.
Oracle jdk is named as Hotspot
$ java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
Non-oracle jdk
$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

UnsupportedClassVersionError... but with same JAVA version

I am trying to migrate a tomcat server.
Both are using tomcat7 version and all is supossed to be ready to take my java/jsp files from one server to another.
I did and I got UnsupportedClassVersionError error.
It was normal as in the old one I had JRE 1.8 version and in the new installation I had JRE 1.7 version (both from Oracle).
I proceeded to upgrade the second to 1.8. And everything was fine as in the new the output for java -version is:
java version "1.8.0_191" Java(TM) SE Runtime Environment (build
1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
While in the old one:
java version "1.8.0_131" Java(TM) SE Runtime Environment (build
1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
In both echo $JAVA_HOME outputs:
/usr/lib/jvm/java-8-oracle
I restarted tomcat and server itself... but the UnsupportedClassVersionError persists.
I don't know if:
Somewhere I still point to the JRE 1.7 installation
Or 1.8.0_191 is considered another version than 1.8.0_131
Note: the compiler is the same as they have not been recompiled. Just take the compiled ones from old server (where there is no problem version) to the new one.
Has anyone a hint for me?
Thank you very much
As pointed in comments, sometimes JAVA_HOME is not checked and the decision on what jvm should be used is taken with another criteria (can't say which ones). So removing the old version of java forced the process to choose the desired one as it was unique.

How to find the java update version?

I have a jre installed installed in my windows.
When I use the command
java -version
I get the output -
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
I can see only the major version 1.7.
How to know which version of JRE update it is ?
Calling java -version will give you the installed version, including the update number (here: 51):
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
It seems like you have the base version installed, so there is no update number:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)
I guess the build gives you the update you have.
You can try this as well-
java -fullversion
Version number translation: 1.6.0_34 is, in English, Java 6 Update 34
Looking at this page from the release note: http://www.oracle.com/technetwork/java/javase/jdk7-naming-418744.html
It seems you have the 1st java 7 version.
Oracle periodically makes updates available and, when an update occurs, the version string will also include the update version number. So, JDK 7 update 4, or JDK 7u4, will have the version string "1.7.0_4".
Normally the jre folder is named something like 1.VersionNumber.0_UpdateNumber
For 64 bit you can find this folder under C:\Program Files (x86)\Java
If your version Number just look like this: 1.VersionNumber.0, this means that you have the first release of given Java Version.

Why isn't javafx on the default classpath even when I have installed Oracle JDK 1.8?

I'm using Oracle JDK 1.8.0.45 on Kubuntu Linux which I installed following these instructions. I had to do the manual install since the automatic one didn't work.
Even with the Oracle JDK I still can't use javafx without manually setting the classpath. What could cause javafx to not be on the default classpath as it should be in 1.8?
EDIT: Java -version in terminal gives:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

How should I upgrade my Java compiler

When I run $ javac Simulator.java then I get the following warning:
warning: ./particle_simulator/Atom.class: major version 51 is newer than 50, the highest major version supported by this compiler.
I don't know why I suddenly get this warning as I haven't made substantial changes to my code. Nevertheless, how do I upgrade my Java compiler?
I'm running Mac OSX 10.7.5 and my Java version is below:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Download the JDK from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/ . Make sure you get the OSX version. It has its own installer so installation should be pretty straight forward.

Categories

Resources