This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Im just starting as a programmer. When im at school, i can compile at java. But when i try to compile a program at home, it says javac is not recognized as an internal or external command error. I really dont know what to do. I tried changing the environment settings but still, nothing happened. What should i do?
In that case you haven't set up the PATH environment variable properly.
If you are running Windows open a command prompt and type
and make sure that the bin directory of your JDK installation is included
Joined: Jan 11, 2013
It says C:\Windows\system32 is not recognized as an internal or external command, operable program or batch file.
If you want to begin coding right away for some reason, then try this -
If you have a windows pc, then set the 'path' variable to point to javac.exe. 'Path' is located in 'environment' variables in 'my computer'. A long time ago i read that this method has some disadvantages. But, at least you can begin working right away.
When you have more time on hand, reset the path and try command line.
google 'setting path environment variable windows' for detailed instructions.
Java Newbie with 72% in OCJP/SCJP - Super Confused Jobless Programmer.
I am a "newbie" too. Please verify my answers before you accept them.
Joined: Aug 05, 2005
Andy Jack wrote:If you have a windows pc, then set the 'path' variable to point to javac.exe.
No. It should point to the directory that javac.exe is in, not javac.exe itself. And if you look at the PATH that Sky posted earlier you will see that it already does this.
Andy Jack wrote:A long time ago i read that this method has some disadvantages. But, at least you can begin working right away.
As long as you add the directory to the PATH variable (rather than overwriting anything that is already in the PATH), then this is the correct way to do it.
Joined: Jan 11, 2013
This is the variable value of my Path in the environment %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShel l\v1.0\;C:\Program Files (x86)\Java\jdk1.7.0_10\bin
I do not put the Java bin directory to PATH but put wrapping scripts to the PATH like javac16, java16, javap16, javac17, java17, javap17 etc.
They invoke javac, java, javap directly with the full path names.
Thus several versions coexist peacefully on the same box.
First locate where java is installed, and where javac.exe is located.
This will probably be something along the lines of C:\jdk\bin\ or C:\Program Files\Java\jdk\bin\
Second, go to Windows Explorer, right click My Computer, go to Properties, the Advanced tab, Environmental Variables.
Under System variables, look for Path. Do NOT remove anything here, but at the END add a semicolon (;) and put path till C:\Program Files\Java\jdk\bin\
Remember put correct folder name.
Joined: Oct 13, 2005
Divya Chandel wrote: . . . Do NOT remove anything here, but at the END add a semicolon (;) and put path till C:\Program Files\Java\jdk\bin\ . . .
That is incorrect. The path to the new Java installation belongs at the beginning of the PATH.
You should remove old Java installation folders from the PATH.