MinGW和JDK在路径中互相禁用对方的可执行文件 [英] MinGW and JDK mutually disable each other's executables in path

查看:189
本文介绍了MinGW和JDK在路径中互相禁用对方的可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有以下设置仅在系统变量中(我的用户变量不包括JDK或MinGW地址)。我有一个 JAVA_HOME 环境变量设置如下:
JAVA_HOME - C :\Program Files\Java\jdk1.8.0_66



(这产生的行为与我写的地址相同当我的路径变量以%JAVA_HOME%\bin开头时,$ / $ C:\MinGW\bin; ... 我在cmd中获取正确的 javac 访问权限,但不是 gcc g ++ 的作品。
通常的错误信息:


'g ++'不被识别为内部或外部命令,可操作的程序或批处理文件


当我的路径变量以 C:\MinGW\bin %JAVA_HOME%\bin; ... 我正在工作 gcc 命令,但现在 javac 是无法识别的...


'javac'不被识别为内部或外部命令,可操作的程序或批处理文件




我如何解决这个问题?



(我正在为Eclipse设计开发Android环境使用cocos2d-x,我使用MinGW v4.8.1,JDK 1.8 x64和Win v8.1 x64)






我的完整路径如下所示:



%JAVA_HOME%\bin;

C:\MinGW\bin;

C:\ProgramData\Oracle\Java\javapath;

C:\Windows\system32;

C:\Windows;

C:\Windows\System32\Wbem;

C:\Windows\System32\WindowsPowerShell\v1.0\;

C:\程序文件(x86)\NVIDIA Corporation\PhysX\Common;

C:\Program文件(x86)\Windows Kits\ 8.1\Windows Performance Toolkit\;

C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;

C:\程序文件\Microsoft SQL Server\120\Tools\Binn\;

C:\程序文件(x86)\CMake\bin;

C :\Program Files\TortoiseHg\;

C:\Program文件(x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\ ;

C:\程序文件(x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;

C:\Program文件(x86)\Microsoft SQL Server\130\Tools\Binn\;

C:\Program文件(x86)\Microsoft SQL Server\130\DTS\Binn \;

C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;

C:\\ \\ Program Files(x86)\Microsoft SQL Server\120\Tools\Bi nn\;

C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;

C:\Program文件(x86) \GtkSharp\2.12\bin;

C:\程序文件(x86)\Skype\Phone\



其中javapath间接地指向JRE exe的。



编辑:

jdk1.7.0_79 x64产生相同的结果(我从现在开始坚持1.7 )



编辑:

我重新安装了mingw,没有改变。如果jdk地址在mingw地址之前,所有的mingw可执行文件都变得无法访问,反之亦然,这正在杀死我:(



我尝试了很多变体,JRE的路径必须在MinGW的路径之前,否则我甚至不能从cmd调用java,但是它并不会像JDK那样禁用MinGW的exe。



所以这个变体例如仍然隐藏所有MinGW exe的路径:

C:\Program Files\Java\jre1.8.0_66\bin;

C:\Program Files \Java\jdk1.7.0_79\bin;

C:\MinGW\bin;
etc ...

解决方案

哦..我的..上帝... Windows - 只能找到PATH环境变量的第一个条目



空间!!!请勿在SEMICOLON !!之后留空。



(谁创建环境变量编辑UI(特别是解析)以及MSVS的包含/链接编辑应该是 CENSORED


All following settings are in system variables only (my user variables don't include either JDK or MinGW addresses). I have a JAVA_HOME environment variable set up like this: JAVA_HOME - C:\Program Files\Java\jdk1.8.0_66

(this produces the same behavior as if I had written the address of jdk to the path)

When my path variable begins with %JAVA_HOME%\bin; C:\MinGW\bin; ... I get correct javac access in cmd, but neither gcc nor g++ works. Usual error message:

'g++' is not recognized as an internal or external command, operable program or batch file

And when my path variable begins with C:\MinGW\bin; %JAVA_HOME%\bin; ... I get working gcc commands but now javac is unrecognized...

'javac' is not recognized as an internal or external command, operable program or batch file

How can I solve this problem?

(I'm trying to set up an environment for Eclipse to develop to Android with cocos2d-x, I use MinGW v4.8.1, JDK 1.8 x64 and Win v8.1 x64)


My full path looks like this:

%JAVA_HOME%\bin;
C:\MinGW\bin;
C:\ProgramData\Oracle\Java\javapath;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files (x86)\CMake\bin;
C:\Program Files\TortoiseHg\;
C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;
C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;
C:\Program Files (x86)\GtkSharp\2.12\bin;
C:\Program Files (x86)\Skype\Phone\

Where javapath indirectly points to JRE exe's.

Edit:
jdk1.7.0_79 x64 produces the same result (I'm sticking with 1.7 from now on)

Edit:
I reinstalled mingw, nothing changed. If the jdk address precedes the mingw address, all mingw executables become unreachable, vica-versa, this is killing me :(

I tried many variations, the path to JRE must precede the path to MinGW, otherwise I can't even call "java" from cmd, however it doesn't disable MinGW's exe's like the JDK does.

So this variation for example still hides all of MinGW exe's from The Path:
C:\Program Files\Java\jre1.8.0_66\bin;
C:\Program Files\Java\jdk1.7.0_79\bin;
C:\MinGW\bin; etc...

解决方案

Oh.. My.. God... Windows - only the first entry of PATH-environment variable can be found

THE SPACES!!! DON'T PUT SPACE AFTER A SEMICOLON!!

(Whoever created environment variable editing UI (especially the parsing), along with MSVS's inclusion/linkage editing, should be CENSORED)

这篇关于MinGW和JDK在路径中互相禁用对方的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆