when i type javac classname.java an error comes that "javac is not recognized as an internal or external command,operable command or batch file"... whereas when i use Netbeans IDE,the program successfully runs...this means that my SDK is successfully installed so what is the problem?? please help...
Why do we fall? So that we can learn to pick ourselves up.
The problem is Windows does not know where javac.exe is located. When you ask for it by typing a command starting with it, it checks the current folder, then each of the folders it knows to check, without any results. To fix this, the java folder must be one it checks.
To do this, 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\ - I do not use Java personally so I'm not sure.
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 instead at the END of "Variable value" add a semicolon (;) and a space, followed by the path you found earlier.
Since you are using NetBeans, you may want to be sure that your javac command invokes the same compiler that NetBeans is using. I have noticed that it is pretty easy to end up with more than one compiler on one computer, especially when you are getting started.
To find out which one NetBeans is using, choose "Tools / Java Platforms" from the IDE menubar. The Java Platform Manager dialog box will appear. Near the top, it will have two text boxes, one labeled, "Platform Name," and the other labeled, "Platform Folder." Most likely, if you are just getting started, there will only be one platform on your computer ("platform" basically refers to a release of the Java Development Kit). That one platform will have the word "(Default)" next to it in the Platform Name text box. (If you have more than one, you probably want the default platform, though, if you are compiling a file you created in the NetBeans IDE editor, you want the one that came with the platform you are using to development the project that file is part of; if that makes no sense, just ignore it, as you probably only have one platform installed right now anyway.)
When you take Vimal's advice, the entry you want to add to the end of the PATH environment variable will be the full path listed in Platform Folder, but with "\bin" added to the end.
If you ever do install a new platform, even for an upgrade, be sure to change your PATH variable so it points to the directory with your new javac.exe file in it, not the old one. (Compiling with an old and a new compiler can create some maddening debugging problems, which some people refer to as the disease called "versionitis." You don't want to get versionitis, I assure you.)