UnsupportedClassVersionError... but with same JAVA version - java

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.

Related

Eclipse: "Could not find Java SE Runtime Environment"

I have just downloaded Eclipse and tried to run it, and it gave me this error message:
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
After closing the errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the jdk multiple times.
After following some other posts i saw, i have also made sure that %JAVA_HOME% was included in PATH
(%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version i got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
According to this answer maybe you messed up with your registry, make sure all java removed first and reinstall JRE.
For me if I want to develop java apps, I would install JDK instead of JRE, after install pls check java & javac command exist
'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment. After closing the
errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the JDK multiple times. After following some other posts I saw, I have also made sure that %JAVA_HOME% was included in PATH (%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version I got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
share edit
asked
1 hour ago
Csalagovits Máté
1●11 bronze badge edited
5 secs ago
One thing I noticed is the JAVA_HOME path refers to JDK 13, while the "java -version" command points to 1.8. Specify the version of Windows and Eclipse you have used in this question. Also, make sure you restart the PC after installing Java. – Shankar P S 52 mins ago
#ShankarPS Edited the question to adress your concerns – Csalagovits Máté 2 mins ago

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)

Java - Mac os x - two versions

I recently updated my java version to "Java 8 update 77".
As far as i know, this is the newest version...
My Java Control Panel prints the same information,
but when i switch to terminal to verify the java version:
java -version
it outputs:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
When i type:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
it prints correctly:
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
So, did i anything wrong?
Why are there two different versions listed ?
Thanks and Greetings!
When Java is updated, it doesn't override the older version. It keeps the older version and also installs new version.
You have to change your $JAVA_HOME environment variable if you want to use new version.
This Link May help
Open the terminal. Type...
nano ~/.bash_profile
Search for export JAVA_HOME. When you find the line, comment it out by placing a # in front of the line.
Type on the next line...
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
assuming that is where the jdk is. Press ctrl+o, ctrl+x.
Type source ~/.bash_profile. And you should be all set.
The second option that you have written about is where you are checking the java applet plugin version which does not need to be the same as the jdk runtime environment.
To make your .bash_profile future proof, you can try this
export JAVA_HOME="$(/usr/libexec/java_home)"

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)

Categories

Resources