File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to fix the error Javac is not recognised as an internal or external command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to fix the error Javac is not recognised as an internal or external command" Watch "How to fix the error Javac is not recognised as an internal or external command" New topic
Author

How to fix the error Javac is not recognised as an internal or external command

deepa karra
Ranch Hand

Joined: Apr 04, 2008
Posts: 46
I have windows vista operating system. I downloaded Java version6 update 5. When I compile a java program I get the error javac is not recognised an internal or external command.

[ April 15, 2008: Message edited by: deepa karra ]
[ April 15, 2008: Message edited by: deepa karra ]
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11257
    
  16

are you trying to download the JRE or the JDK? and why can't you download it - is the site down, do you not have enough space on your hard drive, do you not know where to go to get it, or do you not know what to download?

are you trying to set the classpath, or the path? there is no such thing as 'class path'.

The more specific your question, the easier it is to help you.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

First, what do you mean by "not able to download Java"? What exactly is happening when you try?

Second, why are you trying to set the CLASSPATH? (Especially if you were not able to download Java.) You should be updating the PATH, but you should probably not be setting a CLASSPATH.

When you download JDK 6 Update 5, be sure to follow the installation instructions, which will tell you how to update the PATH variable.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by deepa karra:
I have windows vista operating system. I downloaded Java version6 update 5. When I compile a java program I get the error javac is not recognised an internal or external command...

This is because the PATH is not updated. See the link to the installation instructions I posted above. Step 4 addresses this.
[ April 15, 2008: Message edited by: marc weber ]
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
ok it is a very common thing that beginners experience... All you need to do is set the proper path and also your classpath

you can do this from your command line as follows

set path =%PATH%;"C:\Program Files\Java\Jdk\bin....."

and also please do not forget to add the same to your environment variables.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Govind SrinivasaRaghavan:
...and also your classpath...

Please do not set a CLASSPATH.

Follow the instructions linked to above for updating the PATH.
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
sorry that i mentioned about class path...You need to just set your path
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11257
    
  16

Originally posted by Govind SrinivasaRaghavan:
sorry that i mentioned about class path...You need to just set your path
There is no such thing as a "class path". there is a "path" and a "classpath". the latter should not be set (for beginners).
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
yup...i just wanted to say path and i probably messes it up in my earlier post...and i indeed know it is "classpath", the space was unintentional

apologies all around

Sorry for the typographical error in my last rely
deepa karra
Ranch Hand

Joined: Apr 04, 2008
Posts: 46
I clicked on mycomputer->properties->advanced systemsettings->environment variables->path

I've set the path as c:\programfiles\java\jdk1.6.0_05\bin;

I save my java program in c:\javaex
In the commandprompt, I typed cd c:\javaex
when I compiled the program using javac hello.java,
i got the error javac not an internal or external command
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

The most common mistake is that after you set the PATH, you forgot to exit the shell. Open a new shell afterwards and the changes should be reflected in the newly open shell.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Prashant Poman
Greenhorn

Joined: Feb 13, 2008
Posts: 7
Hi,

I have set the PATH in environment variables as follows. Just replace it with the version you are using.Do not forget to include the double quotation mark (" ")as shown below.It is a common mistake.

PATH="C:\Program Files\Java\jdk1.5.0_08\bin";%PATH%

Prashant.
deepa karra
Ranch Hand

Joined: Apr 04, 2008
Posts: 46
I am still unable to fix the error..
When i looked in c:\java I found three more folders jre1.6_01,jre1.6_02,jre1.6_03
I didnot find Jdk there. I am totally confused about the installation and setting the path.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Check Fred's first question: "are you trying to download the JRE or the JDK"

Which have you installed? Check "Manage Programs" (I think that is what it is called in Vista - I may be wrong) in Control Panels to see what you have installed.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Prashant Poman
Greenhorn

Joined: Feb 13, 2008
Posts: 7
As you are telling that you have only JRE , now try to download JDKJDK 6 Downloadfrom here
deepa karra
Ranch Hand

Joined: Apr 04, 2008
Posts: 46
yeah...finally i got it...
Thanks everybody!!
 
 
subject: How to fix the error Javac is not recognised as an internal or external command