解决Ubuntu上java和javac之间的版本冲突 [英] Resolving version conflict between java and javac on Ubuntu

查看:547
本文介绍了解决Ubuntu上java和javac之间的版本冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu上编译的Java应用程序有问题。它抛出 UnsupportedClassVersionError
我编译的JDK版本比我在PATH中配置的运行Java的版本更高:

I have a problem with my compiled Java application on Ubuntu. It throws UnsupportedClassVersionError. I am compiling with a higher JDK version than the one that is configured in my PATH to run Java:

$ javac -version
javac 1.7.0_147

$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
OpenJDK Client VM (build 20.0-b11, mixed mode, sharing)

如何解决这个问题?

推荐答案

运行以下任一项以找到该位置的位置

Run either of the following to locate where the location is of that

javac 1.7.0_147

使用如下:

whereis javac

 locate javac

find javac

然后,一旦找到目录,就象征性地强制将bin内容链接到/ usr / bin:

Then once you found the directory, symbolically and forcefully link the bin contents to /usr/bin:

sudo ln -f -s [put location here]/bin/* /usr/bin

这篇关于解决Ubuntu上java和javac之间的版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆