How to change java version in Linux
How to change default Java version on Linux
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0
When a Java program is compiled, the build environment sets a "target" which is the oldest JRE version the program can support. If you run the Java program on a Linux system which does not meet the lowest JRE version requirement, you will encounter the following error while starting the program.
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0
For example, in this case the program is compiled for Java JRE 1.7 but the system only has Java JRE 1.6.
To solve this problem, you need to change the default Java version you are using to Java JRE 1.7 or higher (assuming that such JRE is already installed).
First, check available Java versions on your Linux system by using update-alternatives command:

In this example, there are four different Java versions that are installed: OpenJDK JRE 1.6, Oracle Java JRE 1.6, OpenJDK JRE 1.7 and Oracle Java JRE 1.7. The default Java version is currently set to OpenJDK JRE 1.6.
If the necessary Java JRE is not installed, you can always install it using these instructions.
Now that there are suitable candidates to change to, you can switch the default Java version among available Java JREs by running the following command:
When prompted, select the Java version you would like to use. In this example, we choose Oracle Java JRE 1.7.

Now you can verify the default Java version as follows.

Finally, if you defined JAVA_HOME environment variable somewhere, update the variable according to the newly set default Java version.
How to change java version in Linux的更多相关文章
- 解决linux下javac -version和java -version版本显示不一致
解决linux下javac -version和java -version版本显示不一致 [javascript] view plaincopy [root@localhost usr]# $JAVA_ ...
- linux JAVA_HOME和 java -version不匹配
~/.bashrc 中更新了jdk, JAVA_HOME 起效果了,但是java -version还是老的. 原因是/usr/bin/java 和usr/bin/javac是一个链接,得改. 使用 ...
- Linux更换jdk版本,java -version还是原来的版本问题
服务器上默认安装版本是: 使用jenkins最新的安装包 2.73.1,启动报错52.0!需要使用1.8进行启动. 两种方式,要么tomcat直接指定,要么修改环境变量,这里我使用修改安装java版本 ...
- [非原创]Project facet Java version 1.8 is not supported解决记录
原博地址:http://blog.csdn.net/dingchenxixi/article/details/51496998 一看知道是因为jdk版本不一致所导致,如何解决? 方法一: 选中项目 P ...
- Project facet Java version 1.8 is not supported解决记录
一看知道是因为jdk版本不一致所导致,如何解决? 方法一: 选中项目 Properties , 选择 Project Facets,右击选择 Java , Change Version 方法二: 在 ...
- eclipse Project facet Java version 1.8 is not supported.
在移植eclipse项目时,如果遇到 “Project facet Java version 1.7 is not supported.” 项目中的jdk1.7不支持.说明项目是其他版本jdk编译的, ...
- 运行java -version报cannot restore segment prot after reloc: Permission denied
linux 安装jdk1.6后,运行java -version,没有出现相关的版本信息,而是出现了以下错误: dl failure on line 685Error: failed /usr/loca ...
- 项目移植过程中报:“Project facet Java version 1.7 is not supported.” 错误
转载: http://my.oschina.net/nly/blog/349081 在移植eclipse项目时,如果遇到 报:“Project facet Java version 1.7 is no ...
- ubuntu中安装jdk 分类: java 学习笔记 linux ubuntu 2015-07-06 17:49 74人阅读 评论(0) 收藏
参考文献:ubuntu 13.04 安装 JDK 先去oracle官网下载jdk,这一段我就不赘述了. 下载好之后先解压,解压方式参见 linux常用的压缩与解压缩命令 ,解压之后,将文件剪贴至/us ...
随机推荐
- bzoj3011
可并堆 复习一下可并堆 维护一个大跟堆,每次把节点儿子打上边权标记,然后合并,可并堆上维护一个size,每次把大于l的弹出,size就是答案 程序中那个d写l和r速度差不多,我写l是表示右儿子到u的最 ...
- openStack logo
- PCB genesis连孔加除毛刺孔(圆孔与圆孔)实现方法(一)
一.为什么 连孔加除毛刺孔 原因是 PCB板材中含有玻璃纤维, 毛刺产生位置在于2个孔相交位置,由于此处钻刀受力不均导致纤维切削不断形成毛刺 ,为了解决这个问题:在钻完2个连孔后,在相交处再钻一个孔, ...
- web自动化测试—selenium游览器下拉框操作
# coding=utf-8'''下拉框实战思路导包:from selenium.webdriver.support.select import Select #下拉框select from sele ...
- scrapy 简单操作
1.创建一个简单的scrapy项目 scrapy startproject search(项目名称)按照提示cd searchscrapy genspider serachname search.co ...
- ORA-01012:not logged on的解决办法
conn / as sysdba 报错ORA-01012: not logged on 发生原因:关闭数据库是shutdown 后面没有接关闭参数中的任何一个. nomal ————- —-所有连接都 ...
- 参加2016华为codecraft编程精英挑战赛后感
2016年4月参加了华为的软件比赛. 关于比赛:给了一道图论的np-hard问题.刚开始完全不知道怎么入手,请教过师兄,自己也琢磨过,没有什么万全的解决方法.注意,这里说的是万全的办法.本科搞算法时候 ...
- MYSQL 使用自定义表变量
mysql 用户自定义表变量,ENGINE=MyISAM DEFAULT CHARSET=gb2312; 制定编码方式,防止乱码 DROP TABLE IF EXISTS p_temp; creat ...
- JS高级——词法作用域
作用域 1.js中没有块级作用域 2.如果有块级作用域,那么下面代码将会是undefined undefined <script> for (var i = 0; i < 10; i ...
- cordova插件分类
1.android自动更新功能所需插件 cordova plugin add https://github.com/whiteoctober/cordova-plugin-app-version.gi ...