0
votes

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...

2

2 Answers

0
votes

Are you trying to access the g++ and javac from the MinGW bash prompt or Windows CMD ?

Assuming it from Windows CMD since you are changing the path there.. everything looks alright to me. Is the g++ available in C:\MinGW\bin ? Also, once you update the PATH, you have to open a new CMD window to make the updated path effective.

0
votes

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)