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

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

问题描述

我在 Ubuntu 上编译的 Java 应用程序有问题.它抛出 UnsupportedClassVersionError.我正在使用比我的 PATH 中配置的更高版本的 JDK 版本进行编译以运行 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)

我该如何解决这个问题?

How can I resolve this?

推荐答案

运行以下任一命令来定位该位置的位置

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天全站免登陆