How to install and switch to the java version (Unsupported major. minor version 52.0) and major. minorversion in ubuntu
Recently, we have been working on a dcos (data center operating system). We need to use marathon for process management. Unfortunately, marathon of version 0.6 is very lacking in API. After the version is changed to version 0.15, the prompt "Unsupported major. minor version 52.0 ", which indicates that the java version is too low and java1.8 is required. I was not very familiar with linux and found some materials to solve this problem.
I am using the ubuntu system. The system comes with 1.6 and 1.7 java packages. This can be seen in the/usr/lib/jvm/directory. Next, perform the following steps:
A. install java 1.8 first. You can download it from the official website: composer. After you find the version you want to download, you can download it directly or right-click the link and download it using the wget + URL. The two installation methods are described below
B. if it is tar. tz format, through the command "tar zxvf jdk-8u73-linux-x64.tar.gz-C/usr/lib/jvm/", it can be decompressed to/usr/lib/jvm/, if it is. run directly in bin format and skip variable configuration.
C. vi/etc/profile Add the following content at the end of the file:
Export JAVA_HOME =/usr/lib/jvm/java1.8.0 _ 73
Export JRE_HOME =$ {JAVA_HOME}/jre
Export CLASSPATH =. :$ {JAVA_HOME}/lib :$ {JRE_HOME}/lib
Export PATH = {JAVA_HOME}/bin: $ PATH
D. Update the default jdk.
Update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.8.0 _ 73/bin/java 300
Update-alternatives -- install/usr/bin/javac/usr/lib/jvm/jdk1.8.0 _ 73/bin/javac 300
Switch version
Update-alternatives -- config java
Select the jdk version number from the command line display, and press Enter.
Update-alternatives -- config javac select the same as above
E. Use java-version and javac-version to check whether the version has been changed.