Jun 20, 2011

javac is not recognised as an internal or external command ??

Recently I started with JAVA SDK. Not so long ago, i thought  I would be moving on to java but was unable to compile it on PC for days. Part of it was due to some kind of lazyness and my be overconfidence. I dont what but as I began writing the first simple program into the worlds best text editor Notepad (or so it may not seem, no not Notepad ++) , seemed there was a problem.
I went on commmand prompt in and wrote what you would expect me to

C:>javac Program.java

And there was an error....Oops

javac i not recognised as an internal or external command and i was like WTF?
Checked on the installation....yeah i had installed the correct version on the correct machine and correctly....yeah.
Googled that for long, google seems to be frustrating these days....especially when these SEO people have come up. Reading on to the forums I had troubled myself long but i had to find the solution.. took a long time but there was a solution....yup

I would keep it straight wont trouble you with all those damn things that these forum people say.

First step is to check whether you have successfully the java thing or not. Open Command Prompt
Write
C\>java -version
It will show you the version of Java you need.
Then in the C drive (back to windows), go to Program files and thereafter the java folder.
Search out for javac.exe file. It will Probably be there inside the bin folder.  Note Down its address.
In my case it was
C:\Program Files\Java\jdk1.6.0_25\bin  Copy the one in your system.

Here you go,
Go to Control Panel. Check out System. Then to Environment variables, therein you will find system variables and there is Path. Click on Path and create Edit beneath. (In case there is no Path variable, click New)

A new dialog box will appear. Therein the variable value, (caution: it may cause problem for other programs) do not delete anything. Just Add the address (you copied above) to the the list and finally in my case for example will appear like this


C:\Program Files\Java\jdk1.6.0_25\bin; C:\xyz................


Click OK to exit the Dialog Boxes and you are done. finally

Go back to command Prompt and you are ready it seems.

Tags problems with javac .exe; unable to compile java; where to compile

No comments:

Post a Comment