• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

"is not recognized as an internal or external command, operable program or batch file" error

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone, I'm new for Java.Two days ago, I downloaded JDK 7u13 32bit (x86) with Netbean http://www.oracle.com/technetwork/java/javase/downloads/jdk-7-netbeans-download-432126.html for windows XP and installed it with default options. I set new JAVA_HOME C:\Program Files\Java\jdk1.7.0_13\ and PATH %JAVA_HOME%\bin;C:\Program Files\Java\jdk1.7.0_13\bin to the instructed place which is - control panel>system>advanced>environment variables>system variables(Before there was no PATH in system variables). Then I opened cmd from desktop and changed its direction to cd\java\ and typed c:\java>javac HelloWorld.java (this is exact location of HelloWorld.java in my computer) and it's continuously showing " it is not recognized as an internal or external command, operable program or batch file" error.

Before I added new topic, I read all instructions and materials regarding to setting path and creating HelloWorld.java here and on oracle's web site. I thought problem is with text editors, and tried to create HelloWorld.java with wordpad editor and nodpad editor and it didn't work. I checked and corrected any misspellings. I deleted and reinstalled Jdk 7u13 and tested on oracle website - whether it's working or not(Java's working). I accessed cmd from start, desktop and restarted each time after setting path. However, all my efforts failed.

Strangely, when I type set path or echo %PATH% on command window, it's displaying the following PATH=C:\Program Files\Java\jdk1.7.0_13\\bin;C:\C:\Program Files\Java\jdk1.7.0_13\bin
PATHEXT=EXE;.BTM;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC
Does it mean that I have set path correctly? If so why I still cannot make javac compile HelloWorld.jav?
Can anyone suggest me what I'm doing wrong and and help me how should I correct it? That would end my 10+ hours of disappointment.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shohruh Sg wrote:I set new JAVA_HOME C:\Program Files\Java\jdk1.7.0_13\ and PATH %JAVA_HOME%\bin;C:\Program Files\Java\jdk1.7.0_13\bin to the instructed place

Strangely, when I type set path or echo %PATH% on command window, it's displaying the following PATH=C:\Program Files\Java\jdk1.7.0_13\\bin;C:\C:\Program Files\Java\jdk1.7.0_13\bin


Note the \\ in your PATH setting. Try removing the \ form the end of your JAVA_HOME setting or remove the \ from the %JAVA_HOME%\bin in your PATH setting.
You've also got C:\C:\Program Files\Java\jdk1.7.0_13\bin in your PATH setting which is why it didn't pick up javac from that part of the PATH variable.
 
Shohruh Gulyamov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joanne Neal wrote:
Note the \\ in your PATH setting. Try removing the \ form the end of your JAVA_HOME setting or remove the \ from the %JAVA_HOME%\bin in your PATH setting.
You've also got C:\C:\Program Files\Java\jdk1.7.0_13\bin in your PATH setting which is why it didn't pick up javac from that part of the PATH variable.





Thanks I corrected and when I type set path now, It looks like this:
PATH=C:\Program Files\Java\jdk1.7.0_13\bin;C:\Program Files\Java\jdk1.7.0_13\bin
PATHEXT=EXE;.BTM;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC

However, I still cannot find javac on cmd. I restarted cmd and still the same error continues displaying.
 
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happened to the PATH value from before you installed Java? It points to things like C:\win32 and C:\System. Have you removed them from your PATH?
Maybe the spaces in the PATH are confusing the computer. Try adding quote marks: not C:\Program Files\Java\jdk1.7.0_13\bin but "C:\Program Files\Java\jdk1.7.0_13\bin". Be sure to add the Java path component at the beginning of the PATH.
Use Window Explorer to confirm that the files java.exe and javac.exe are inside that bin directory.
 
Shohruh Gulyamov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:What happened to the PATH value from before you installed Java? It points to things like C:\win32 and C:\System. Have you removed them from your PATH?
Maybe the spaces in the PATH are confusing the computer. Try adding quote marks: not C:\Program Files\Java\jdk1.7.0_13\bin but "C:\Program Files\Java\jdk1.7.0_13\bin". Be sure to add the Java path component at the beginning of the PATH.
Use Window Explorer to confirm that the files java.exe and javac.exe are inside that bin directory.



Before I installed Java, there was no PATH in system variables. So I manually added the PATH to it. Currently, PATH has following values - %JAVA_HOME%\bin;C:\Program Files\Java\jdk1.7.0_13\bin; and I also have set JAVA_HOME - C:\Program Files\Java\jdk1.7.0_13 to the system variables. Am I doing something wrong? Is there should be C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem at the end of the PATH? or name PATH should be typed between %% (like this - %PATH%)?
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If there was no PATH beforehand, then you have not done any harm by deleting anything.
Did you try adding ""? Don’t add %%.
Which version of Windows are you using?
Please search in the root directory of C for a file called AUTOEXEC.bat, and inspect that, if it exists.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You adding PATH in the system variable settings (which should have C:\Windows\system32 stuff) or in the user environment (default no PATH variable)?

If JAVA_HOME variable is created, you can use this variable in the PATH variable.
 
Shohruh Gulyamov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:If there was no PATH beforehand, then you have not done any harm by deleting anything.
Did you try adding ""? Don’t add %%.
Which version of Windows are you using?
Please search in the root directory of C for a file called AUTOEXEC.bat, and inspect that, if it exists.



I tried with "", but It did not work. I'm using Windows XP SP2. I inspected AUTOEXEC.bat in the root directory of C and it exists.
 
Shohruh Gulyamov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

K. Tsang wrote:You adding PATH in the system variable settings (which should have C:\Windows\system32 stuff) or in the user environment (default no PATH variable)?

If JAVA_HOME variable is created, you can use this variable in the PATH variable.



I was adding it to the system variable settings, so it would be possible to run java with other users.
 
Shohruh Gulyamov
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh finally, problem solved - I corrected the error and ran the java compiler and made Hello World appear on display. The problem was - .COM was missing in PATHEXT. Previously, PATHEXT contained these EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH; and I checked PATHEXT values on google and added .COM to the values. Then It started working.

Thanks a lot for your responses, surely without them I would not be able to correct it!
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What a strange error! Well done sorting it out
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shohruh Gulyamov wrote:Oh finally, problem solved - I corrected the error and ran the java compiler and made Hello World appear on display. The problem was - .COM was missing in PATHEXT. Previously, PATHEXT contained these EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH; and I checked PATHEXT values on google and added .COM to the values. Then It started working.

Thanks a lot for your responses, surely without them I would not be able to correct it!



Hi! Could you tell me please what was the final solution? It doesn't work at me (Win7)
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

The final solution was to add .com
What is the PATH on your computer?
 
Levente Kovacs
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

The final solution was to add .com
What is the PATH on your computer?



Thanks
So. I did the setting at control panel>system>advanced>environment variables>system variables, but somehow the JAVA_HOME doesn't works. It should me my fault. I don't know the exact syntactic.
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please have a look at our FAQ, which tells you about setting the PATH, before you do something which will damage your computer.
 
Levente Kovacs
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Please have a look at our FAQ, which tells you about setting the PATH, before you do something which will damage your computer.



Meanwhile I realized. that it works, without %. Simply type javac, or java anywhere, and it works. Thanks.
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done
 
Levente Kovacs
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Well done



Yes, but meantime occurred an other problem. An older installed app, which is worked properly doesn't start, and gives the following messages:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds serious. You can’t get anywhere without java.lang.Object. Please print your PATH and CLASSPATH with
echo %PATH%
echo %CLASSPATH%

Which old app has stopped working? Do new Java programs run?
 
Levente Kovacs
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:That sounds serious. You can’t get anywhere without java.lang.Object. Please print your PATH and CLASSPATH with
echo %PATH%
echo %CLASSPATH%

Which old app has stopped working? Do new Java programs run?



I reinstalled JRE and JDK., now it all works. I could not imagine what had happened.
 
Campbell Ritchie
Marshal
Posts: 79943
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I nearly suggested a reinstallation. Don’t know what went wrong, but java.lang.Object is a fundamental class, and you can’t do anything without it.
 
Danger, 10,000 volts, very electic .... tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic