本文介绍了注册表项“..."的值为“1.7",但需要“1.6".Java 1.7 已安装并且注册表指向它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发团队最近被迫转到远程开发环境,在那里我们无法完全访问服务器.在转换之前,我们有一个在 Java 1.7 x64 和 JRE 7 上运行良好的 JAR.当我们转移到新服务器时,我们的 JAR 运行正常,但随后其中一位服务器管理员更新"了我们的 Java 到旧版本版本并卸载了我们正在使用的那个.不要问我为什么,我不知道.我重新安装了 Java 1.7 并卸载了 1.6 和 JRE.

My development team recently was forced over to a remote development environment where we do not have full access to the servers. Before the change over we had a JAR that was running fine on Java 1.7 x64 along with JRE 7. When we moved over to the new server our JAR was running alright, but then one of the server admins "updated" our Java to an older version and uninstalled the one we were using. Don't ask me why, I don't know. I re-installed Java 1.7 and uninstalled 1.6 along with the JREs.

运行时出现以下问题,没有构建错误:

The following problem occurs at runtime, there are no build errors:

Registry key 'SoftwareJavaSoftJava Runtime EnvironmentCurrentVersion'
has value '1.7', but '1.6' is required.
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.

我在笔记本电脑上运行了相同的 JAR,没有出现任何问题.服务器和我的笔记本电脑在各自的 %HOME% 变量和系统路径中都有 JDK 1.7 和 JRE 7.我什至重新安装了 JRE 6 并稍后将其放置在系统环境 PATH 变量中,结果相同.

I've run the same JAR on my laptop with no issues. Both the server and my laptop have JDK 1.7 and JRE 7 in the respective %HOME% variables and system PATH. I've even reinstalled JRE 6 and placed it later in the system environment PATH variables with the same result.

我还将注册表改回查看 1.6,结果如下,我查了一下,似乎是安装了多个 Java(导致我原来的问题):

I have also changed the registry back to look at 1.6 and it results in the following, which I looked up and it appears to be from having multiple Javas installed (leading back to my original problem):

Exception in thread "main" java.lang.UnsupportedClassVersionError: ... :
Unsupported major.minor version 51.0

我很感激你们的任何见解,因为我一直在查看各种论坛,但似乎没有什么是我的问题.此外,这也发生在我们正在使用的另一台服务器上.谢谢!

I would appreciate any insight you all have as I have been looking over various forums but nothing seems to have exactly my problem. Also, this has happen on another server we are using as well. Thanks!

更新:将 JAR 重新编译为 1.6 或 1.7 并匹配 JDK 并不走运.另外,为什么新版本的 Java 会破坏旧的编译版本?

Update: No luck with recompiling the JAR to either 1.6 or 1.7 and matching the JDK. Also, why in the world would a newer version of Java break an older compiled version?

推荐答案

当您以某种方式混淆了 java 本身时,就会发生这种情况.您正在尝试运行发现 JRE 7 的 java 6 VM.即使您仅在命令行中键入 javajava -version ,它也可能显示此问题错误配置的环境.JAR 不是问题,除非在极不可能的情况下 JAR 中的代码正在 Windows 注册表中查找(这可能不是您的情况).

This happens when you somehow confused java itself. You are trying to run a java 6 VM where it found a JRE 7. It might show this problem even if you type in the command line just java or java -version in a misconfigured environment. The JAR is not the problem, except in the very unlikely case where the code in JAR is looking in the Windows Registry for that (which probably is not your case).

就我而言,我在 中有来自 Java 6 的 java.exejavaw.exejavaws.exeWindows/System32 文件夹(不知道它是如何出现的).JDK 和 JRE 的其余部分位于 C:Javajdk_1.7.0in 内的 PATH 中.糟糕!

In my case, I had the java.exe, javaw.exe and javaws.exe from Java 6 in the Windows/System32 folder (don't know how it got to be there). The rest of the JDK and JRE where found in the PATH inside C:Javajdk_1.7.0in. Oops!

这篇关于注册表项“..."的值为“1.7",但需要“1.6".Java 1.7 已安装并且注册表指向它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:04