• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

'javac' is not recognized | Special case

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have installed java in my system with all perquisites.
I am using Windows XP. I've set JAVA_HOME variable and set Path as %JAVA_HOME%\bin in environment variables.

Later I open command prompt and run java -version. It shows correct installed version of Java on my machine.

Special case: Whenever I run javac command, it always shows me 'javac' is not recognized as an internal or external command, operable program or batch file.
I don't understand that, if my JAVA_HOME path is correct and contains javac.exe file, then why above message is shown?
Please respond me asap.

Thanks,
Vaibhav
 
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You did install the JDK and not just the JRE, did you? And if so, the JAVA_HOME is pointing to the JDK folder and not the JRE folder, right?
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Did you install the JDK? Or just a JRE?

Henry
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look and see if you HAVE a javac.exe.
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I've intalled jdk 1.6 and obviously, JAVA_HOME is pointing to jdk. As I told earlier, I manually checked in my JAVA_HOME\bin folder to find javac.exe.
javac.exe is already present in JAVA_HOME\bin folder.

Also, if JAVA_HOME is not recognizable, then I can't run java -version command directly.
I can't run javac command even javac.exe was present in my JAVA_HOME\bin folder.

Interestingly, when I double-click javac.exe file, it was running. But while typing javac command in command prompt, it shows 'javac' is not recognized......

Regards,
Vaibhav
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vaibhav Goel wrote:Also, if JAVA_HOME is not recognizable, then I can't run java -version command directly.



Actually that may not be true. You probably have a java.exe in the Windows or Windows\System32 directory. This will run the jave.exe in your JRE which it will find using some registry settings (it doesn't need to be in your path).
So if it is finding java.exe but not javac.exe, it may mean your JAVA_HOME variable is wrong.
 
Marshal
Posts: 80222
424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Print out the contents of %JAVA_HOME% and %PATH%, and let us have a look at them.
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAVA_HOME = C:\Program Files\Java\jdk1.6.0_23
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\Windows Imaging\; %JAVA_HOME%\bin

Regards,
Vaibhav Goel
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would also test:

java -fullversion
$JAVA_HOME/java -fullversion

and ensure they are the same (having access to the 'which' command would be useful at this point)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
spot the Linux user Please translate instructions as necessary
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello David,

Here it is:-
C:\>java -fullversion
java full version is "1.6.0_23-b05"

Regards,
Vaibhav Goel
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There were two lines to test, the aim is to ensure that they are they report the same thing.
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello David,

It is showing below results:
java -fullversion = java full version is "1.6.0_23-b05"
$JAVA_HOME/java -fullversion = '$JAVA_HOME' is not recognized as an internal or external command, operable program or batch file.

Regards,
Vaibhav Goel
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it should be
%JAVA_HOME%\java -fullversion
For windows.
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello David,

It shows below result:
C:\>%JAVA_HOME%\java -fullversion
'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Regards,
Vaibhav Goel
 
Ranch Hand
Posts: 37
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vaibhav Goel wrote:JAVA_HOME = C:\Program Files\Java\jdk1.6.0_23
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\Windows Imaging\;_%JAVA_HOME%\bin

Regards,
Vaibhav Goel



If there's a space before %JAVA in your path variable, please try removing it. (At the position of the bold underscore above.)
 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Mike,

Great!!!
It works fine now. But please tell me two things.
1) Why it does not read space as other paths also contain space?
2) If there was a small space problem, then how come it executes java command?

Thanks,
Vaibhav Goel
 
Mike Rainville
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vaibhav Goel wrote:Hello Mike,

Great!!!
It works fine now. But please tell me two things.
1) Why it does not read space as other paths also contain space?
2) If there was a small space problem, then how come it executes java command?

Thanks,
Vaibhav Goel



1) On Windows XP or OS X, I have never even considered using any blanks, except in a quoted file name; I have no idea why they might work in some cases but not others.
2) You may have had a JRE installed before... (Check the Control Panel for the currently installed versions of Java.)

I'm happy it's working for you now.
 
Rob Spoor
Sheriff
Posts: 22821
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David O'Meara wrote:(having access to the 'which' command would be useful at this point)


UnxUtils
The only problem I have with that with my Windows 7 64 bit machine is that "df" is no longer working.

Vaibhav Goel wrote:1) Why it does not read space as other paths also contain space?
2) If there was a small space problem, then how come it executes java command?


1) Apparently Windows isn't smart enough to trim all paths. As such, the Java part of the path was " C:\Program Files\Java\jdk1.6.0_23" which is not the same as "C:\Program Files\Java\jdk1.6.0_23".
2) Read Joanne Neal's post.
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic