首页 > 编程语言 > 详细

Fix java version mismatch in windows---stackoverflow

时间:2014-12-10 15:43:41      阅读:290      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/davidwang456/p/4155450.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!