Read our FAQ, which tells you how to set the PATH. There are other ways to set the PATH than what we describe.
Sky Mendoza wrote:A long post appeared. I tried running my program but still it says javac is not recognized blah blah.
I'm stumped then I'm afraid. If it works when you type the full path name, then it should work when you type javac.
Maybe someone else will see this post and have some other suggestions.
As a workaround you could try creating a batch file that includes the full path to the javac command and use that for compiling your program.
Sky Mendoza wrote:And btw, what should be the variable value in the Path?
I'm not sure what you are asking. The value of your PATH variable looks okay as it is.
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.
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.
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.
That is incorrect. The path to the new Java installation belongs at the beginning of the PATH.
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\ . . .
you should remove old Java installation folders from the PATH.