• Windows管理多个java版本--解决'has value '1.8',but'1.7' is required'的方法


    公司考虑到代码的可持续维护性,要求全部使用java7,自己又想在空闲时间学一些java8的新特性,故在安装完1.7之后又安装了1.8,导致eclisp在启动时报’has value ‘1.8’,but’1.7’ is required’的错误,在控制台使用Java -version进行查询发现,依然会报’has value ‘1.8’,but’1.7’ is required’的错误,如下

    1 C:>java -version 
    2 Error: Registry key ‘SoftwareJavaSoftJava Runtime Environment’CurrentVersion’ 
    3 has value ‘1.8’, but ‘1.7’ is required. 
    4 Error: could not find java.dll 
    5 Error: Could not find Java SE Runtime Environment.

    这里,环境变量中只配置了1.7,并没有对1.8配置任何环境变量值。 
    经过一段时间的摸索,经如下几步修改,即可将系统默认jdk恢复到1.7:

    1、修改注册表 

    打开HKEY_LOCAL_MACHINESOFTWAREJavaSoft 
    分别修改Java Development kit及Java Runtime Environment中的CurrentVersion值为1.7 

    2、替换文件

    将%JAVA7_HOME%in里的 java.exe javaw.exe javaws.exe 复制到 C:Windows/System32 及 C:WindowsSysWOW64 并替换原有文件,将上述三个文件的快捷方式复制到 C:ProgramDataOracleJavajavapath 并替换原有文件

    如果不替换文件会出现以下问题、;

    C:>java -version 
    Error: Registry key ‘SoftwareJavaSoftJava Runtime Environment’CurrentVersion’ 
    has value ‘1.8’, but ‘1.7’ is required. 
    Error: could not find java.dll 
    Error: Could not find Java SE Runtime Environment.

    3、执行java -version进行验证

    1 C:>java -version 
    2 java version “1.7.0_25” 
    3 Java(TM) SE Runtime Environment (build 1.7.0_25-b17) 
    4 Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
  • 相关阅读:
    SKPhysicsJointPin类
    SKPhysicsJointLimit类
    SKPhysicsJointFixed类
    SKPhysicsJoint类
    SKPhysicsContact类
    SKPhysicsBody类
    SKLabelNode类
    SKNode类
    SKKeyframeSequence类
    Unique Paths II
  • 原文地址:https://www.cnblogs.com/zhunian/p/5590478.html
Copyright © 2020-2023  润新知