This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes 'javac' is not recognized as an internal or external command, operable program or batch file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Watch " New topic
Author

'javac' is not recognized as an internal or external command, operable program or batch file.

Jay Nisha
Greenhorn

Joined: Jun 30, 2009
Posts: 24
Hi,
I am using jdk1.6.0_22 . and I have set path variable to C:\Program Files\Java\jdk1.6.0_22\bin but when i am trying to compile any java program written anywhere then it shows me the error as follows............

D:\SCJPPR~1\7_GENE~1>javac TestSort1.java
'javac' is not recognized as an internal or external command,
operable program or batch file.


Please help me how can i solve this error?

Thanks in advance.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

Once you have set the environment variables - You need to re enter the command prompt. Did you try that? And how did you set your PATH variable value?


Mohamed Sanaulla | My Blog
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11151
    
  16

on a command prompt you can type

echo %path%

and see what that window's current path is - make sure it includes the correct path to the java bin.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Paul Okeke
Ranch Hand

Joined: May 16, 2009
Posts: 58
According the value you wrote, the path value is correct but I will advice you to do these checks.
Depending on who you set the path:

I am assuming that you run windows
If you have set it permanently on your machine in the environment variable, the confirm that there is a ";" separating any path preceding the one you just set.

Again open the command prompt and type echo %path%
You should get a list all the items in your path (each separated with ;) including the path to your JDK.

Else, open a new Command Prompt and type:
set path=
set path=thePathToYourJDK_JustAsYouIndicatedAbove


OCJP 1.6
Jay Nisha
Greenhorn

Joined: Jun 30, 2009
Posts: 24
mohamed sanaullah wrote:Once you have set the environment variables - You need to re enter the command prompt. Did you try that? And how did you set your PATH variable value?




Thanks Mohamed,
Your solution works.Actually I hadn't re enter the command prompt after setting environment variables.
Thanks for replying me n giving solution.
Nandu Nandini
Greenhorn

Joined: Jan 20, 2013
Posts: 2
hi,
im using jdk 1.6.0 after i set the path, in command prompt its showing an error like 'javac' is not found as an internal or external command, operable program or batch file
please help me to solve this problem
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18500
    
  40

Nandu Nandini wrote:hi,
im using jdk 1.6.0 after i set the path, in command prompt its showing an error like 'javac' is not found as an internal or external command, operable program or batch file
please help me to solve this problem


Considering that you posted to a two year old topic -- can we assume that you tried the suggestions in this topic and failed? And if so, can you tell us the details of what happened when you tried them?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Nandu Nandini
Greenhorn

Joined: Jan 20, 2013
Posts: 2
ya i followed given suggesions but i am not able to compile program, if i enter javac to compile in command prompt its showing an error like 'javac' is not found as an internal or external command, operable program or batch file
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37900
    
  22
Welcome to the Ranch
Did you open a new command line? The new PATH is not applied to the old command window.
How have you set your PATH environment variable? Please execute echo %PATH% and show us the output.
zira ramli
Greenhorn

Joined: Feb 24, 2013
Posts: 2
this is path from cmd



[Thumbnail for path.PNG]

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37900
    
  22
Those screenshots are illegible. Please post real text.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37900
    
  22
Welcome to the Ranch
Please don’t add new questions to an old thread; fortunately I can split off your question to a new thread.
Which environment variable is that? Why does it have so many components in? Does %JAVA_HOME% and with \?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37900
    
  22
zira ramli,
Your post was moved to a new topic.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: 'javac' is not recognized as an internal or external command, operable program or batch file.
 
Similar Threads
How do i set a/the classpath.
Running code
Not able to run java
Running java programs on the commamd line
Setting the classpath