zoukankan      html  css  js  c++  java
  • Fix java version mismatch in windows---stackoverflow

    Question:

    I have the 64bit version of the jdk installed on windows 7. I installed the 32 bit version of the jre as websites complained that I didn't have the java plugin. I tried in vain to get firefox to recognize the 64bit jre probably because firefox is 32bit.

    C:UsersUSER>java -version
    java version "1.6.0_31"
    Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
    Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)
    
    C:UsersUSER>javac -version
    javac 1.7.0_02
    

    Because of this, I can't run any of the programs that I compile. The entire thing is a real mess, here's my path. I have no idea why the java and javac versions don't match.

    C:UsersUSER>echo %path%
    C:Program Files (x86)PC Connectivity Solution;
    C:Program Files (x86)NVIDIA CorporationPhysXCommon;
    C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;
    C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesWIDCOMMBluetooth Software;
    C:Program FilesWIDCOMMBluetooth Softwaresyswow64;
    C:Program Files (x86)QuickTimeQTSystem;
    c:Program Files (x86)Microsoft SQL Server110ToolsBinn;
    c:Program FilesMicrosoft SQL Server110ToolsBinn;
    c:Program FilesMicrosoft SQL Server110DTSBinn;
    C:Program FilesJavajdk1.7.0_02in;C:UsersUSERgnumsysgitmsysgitin;
    C:UsersUSERgnuin;
    C:UsersUSERgnu
    uby-1.9.3-p0-i386-mingw32in
    

    If anybody has any pointers on how to fix this sort of a thing in windows, that'd be most appreciated.

    Answer

    It seems that you have

    • JDK 1.7.0_02 64 bit
    • JRE 1.6.0_31 32 bit

    JRE also puts a java.exe to c:WindowsSystem32, that's how first command is resolved. Second command is resolved by the C:Program FilesJavajdk1.7.0_02in entry in your PATH variable.

    If (and when) you are developing from the command prompt, you have to adjust the PATH variable so that C:Program FilesJavajdk1.7.0_02in is before c:WindowsSystem32.

    You can also persistently change the order, since Java browser extension does not depend on command line binaries and is installed separately.

    My usual schema in windows is installing JDK's and also installing nested public JRE's whenever necessary. It's very similar yo your schema. You just need to adjust PATH variable a bit if you will be working from command prompt.

    原文地址:http://superuser.com/questions/391977/fix-java-version-mismatch-in-windows

  • 相关阅读:
    我今天能懂
    SpringMVC之RequestContextHolder分析
    idea只导入部分依赖
    idea中GitPush失败问题
    SpringBoot常用配置,引入外部配置文件信息,热加载
    idea的yml文件不识别问题
    SpringBoot介绍,快速入门小例子,目录结构,不同的启动方式,SpringBoot常用注解
    Java连接Redis,存储对象获取对象()byte和json),连接池
    Nginx的反向代理
    Nginx介绍,安装,配置
  • 原文地址:https://www.cnblogs.com/davidwang456/p/4155450.html
Copyright © 2011-2022 走看看