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:\Users\USER>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:\Users\USER>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:\Users\USER>echo %path%
C:\Program Files (x86)\PC Connectivity Solution\;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;
C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;
C:\Program Files (x86)\QuickTime\QTSystem\;
c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;
C:\Program Files\Java\jdk1.7.0_02\bin;C:\Users\USER\gnu\msysgit\msysgit\bin;
C:\Users\USER\gnu\bin;
C:\Users\USER\gnu\ruby-1.9.3-p0-i386-mingw32\bin

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:\Windows\System32, that's how first command is resolved. Second command is resolved by the C:\Program Files\Java\jdk1.7.0_02\bin 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 Files\Java\jdk1.7.0_02\bin is before c:\Windows\System32.

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

Fix java version mismatch in windows---stackoverflow的更多相关文章

  1. [Android] "Failed to find Java version for 'C:\Windows\system32\java.exe"

    Impossible to install SDK r17 on win 7 x64 "Failed to find Java version for 'C:\Windows\system3 ...

  2. 安装Android Studio报failed to find java version for 'C:\windows\system32\java.exe':[2] The system cannot find the specified file.错误的解决方案

    方案很简单,找到SYSTEM32目录下的java.exe文件,重命名为java.exe.orj. 方案出处:http://stackoverflow.com/questions/10339679/an ...

  3. Description Resource Path Location Type Java compiler level does not match the version of the installed Java project facet Unknown Faceted Project Problem (Java Version Mismatch)

    project 编译问题,需要三处的jdk版本要保持一致,才能编译通过. 1.在项目上右键properties->project Facets->修改右侧的version  保持一致 2. ...

  4. Windows Intellij环境下Gradle的 “Could not determine Java version from ‘9.0.1’”的解决方式

    当我导入Gradle项目初试Java spring的时候,遇到下面报错: Gradle complete project refresh failed Error:Could not determin ...

  5. JDK1.6 1.7 1.8 多版本windows安装 执行命令java -version 版本不变的问题

    现在Windows的java安装已经没有解压版本,Oracle官方也不会再提供了,只有安装程序 所以每当安装一次JDK,都会将 java.exe.javaw.exe.javaws.exe三个可执行文件 ...

  6. windows系统下,安装多个版本的jdk,java -version

    问题描述: 开始安装了 jdk8 后来装了jdk9,可以为项目配置不同的jdk,相安无事: 今天发现软件需要jdk8的环境,结果我的java -version始终是jdk9.0.1: 解决办法:使ja ...

  7. java -version 问题 : C:\ProgramData\Oracle\Java\javapath;

    我把 JAVA_HOME 从8改成了 7 , 为什么还是 显示的8啊 ! E:\sv0\jars>java -version java version "1.8.0_111" ...

  8. java -version 问题

    我把 JAVA_HOME 从8改成了 7 , 为什么还是 显示的8啊 ! E:\sv0\jars>java -version java version "1.8.0_111" ...

  9. 【转】运行java -version命令时出现错误及解决

    转载地址:http://blog.sina.com.cn/s/blog_50f21fed01012sf2.html     按照上一篇的步骤配置JAVA_HOME.CLASSPATH和Path三个变量 ...

随机推荐

  1. PM【terminal】

    More Knowledge More Performance More Time 资料模组化 以知识管理为基础的项目管理 规范:ethic

  2. ubuntu 下截图工具的使用

    我个人觉得,ubuntu自带的截图工具功能就不错.具体使用如下: 在ubuntu下的系统设置中找到硬盘区的“键盘”处,进入该设置界面如下: 选择标签“快捷键”,进入新设置界面如下所示: 之后,你就可以 ...

  3. 几个模式识别和计算机视觉相关的Matlab工具箱

    模式识别.计算机视觉.图像处理等领域大部分是对一些图像等数据的处理,比较常用的语言是C++和Matlab,相应也对应很多库,象opencv等,都是很好用功能也很强大,但是对于数据处理更方便的应该还是M ...

  4. matlab操作之--读取指定文件夹下的“指定格式”文件

    %% 正负样本所在folder fext='*.png';%要读取的文件格式 positiveFolder='F:\课题\Crater detection\machingLearning\Positi ...

  5. VC 项目支撑文件解释

    1.解决方案文件:   a.sln 解决方案.把项目中的所有元素或者多个项目整合到一个解决方案中去. b.suo 解决方案定制项.存储用户级别对解决方案的定制,比如打开状态,断点信息.   这两个文件 ...

  6. 在Windows下读取Ext4分区

    转自在Windows下读取Ext4分区 本文介绍两个能在 Windows 下读取ext4分区的软件. 第一个是 Ext2Read.它能查看 ext2/3/4 分区并从中拷贝文件和目录,支持 LVM2 ...

  7. 【UVA10972】RevolC FaeLoN (求边双联通分量)

    题意: 给你一个无向图,要求把所有无向边改成有向边,并且添加最少的有向边,使得新的有向图强联通. 分析: 这题的解法还是很好想的.先用边双联通分量缩点,然后找新图中入度为0和为1的点,入度为0则ans ...

  8. 在linux中使用php将word文档转为pdf

    使用本教程需要在linux中安装openoffice,改页面中有详细的安装与使用教程(http://www.cnblogs.com/sustudy/p/3999628.html). 既然,你看了该教程 ...

  9. 运行时改变控件的大小(点击后立刻ReleaseCapture,然后计算位移,最后发消息改变位置)——最有趣的是TPanel其实也有窗口标题,因此可发HTCAPTION消息

    //光标在控件不同位置时的样式 // 由于拐角这点手动精确实在困难 所以用范围 范围+3 这样很容易就找到这一点了 procedure CtrlMouseMove(Ctrl: TWinControl; ...

  10. WPF Image控件中的ImageSource与Bitmap的互相转换

    原文:WPF Image控件中的ImageSource与Bitmap的互相转换  1.从bitmap转换成ImageSource [DllImport("gdi32.dll", ...