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. github避免每次输入账户密码

    方法1: 显示所有隐藏目录,找到目录./git下的文件config文件,通过文本方式打开,在最前面添加如下两行.之后再次输入一次密码后就会记住账号密码. [credential]     helper ...

  2. 01 Hello, Python!

    目标:万能的Hello,World! 接收用户输入,并打印出来. #!/usr/bin/python # First comment print("Hello, Python!") ...

  3. java特点

    简单: Java语言的语法与C语言和C++语言很接近,使得大多数程序员很容易学习和使用.另一方面,Java丢弃了C++中很少使用的.很难理解的.令人迷惑的那些特性,如操作符重载.多继承.自动的强制类型 ...

  4. GHOST备份

    整理日: 2015年2月16日 GHOST Disk2GHO STEP01 STEP02 STEP03 STEP04 STEP05 STEP06 STEP07 STEP08 STEP09 STEP10

  5. HNOI2015滚粗记

    HNOI2015滚粗记 经过两天的苦战,艰难的HNOI终于结束了.感觉这次HNOI自己还是收获了许多. \(Day1\)打的很是艰难,题目一下就有种晕头转向的感觉.开场\(20min\)自己还在读题时 ...

  6. JdbcTemplate 操作Oracle Blob

    1:增加操作 public int addTest(TestVo tv) { byte bz[] = tv.getBz().getBytes(); LobHandler lobHandler = ne ...

  7. MockupBuilder

    玩一下,想起了以前公司产品经理作的些事了...

  8. SysErrorMessage 函数和系统错误信息表

    在看 API 文档时, 我们经常见到 GetLastError; 它可以返回操作后系统给的提示.但 GetLastError 返回的只是一个信息代码, 如何返回对应的具体信息呢?FormatMessa ...

  9. (转) Android的Window类

    Android的Window类 2011-03-25 10:02 by Keis, 110 visits, 网摘, 收藏, 编辑 Android的Window类(一)  Android的GUI层并不复 ...

  10. Linux Eclipse代码提示功能设置(Java & C/C++)

    最近在Linux下开发,由于长期使用Visual Studio 2010,对代码提示功能情有独钟,现在在Linux下,使用Eclipse做开发,当然免不了怀念Visual Studio强悍的代码提示, ...