centos环境中java升级
探序基因肿瘤研究院 整理
在下载了picard-3.1.1.jar的软件后,运行:java -jar picard-311.jar MarkDuplicates I=x.sort.bam O=x.sort.rmdup.bam CREATE_INDEX=ture REMOVE_DUPLICATES=ture M=x.sort.metrics.txt
出现错误:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: picard/cmdline/PicardCommandLine has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
在服务器输入:java -version
提示:
java version "1.8.0_333"
Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.333-b02, mixed mode)
java的编译环境版本太低,java 8 class file的版本是52,Java 7虚拟机只能支持到51。所以需要升级到java 8 vm才行。
一下为jdk的version对照表
Java SE 9 = 53,
Java SE 8 = 52,
Java SE 7 = 51,
Java SE 6.0 = 50,
Java SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45
安装java以及jdk,参考:Linux/CentOS7安装JavaJDK8及配置环境变量
上传jdk-21_linux-x64_bin.tar.gz到服务器,tar -zxvf jdk-21_linux-x64_bin.tar.gz解压缩。
再配置一下环境变量,就可以了。
下载java jdk这个包,需要oracle账号。简单注册一下就可以