Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

'javac' is not recognized | Special case

 
Vaibhav Goel
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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?
 
Henry Wong
author
Marshal
Pie
Posts: 21123
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Did you install the JDK? Or just a JRE?

Henry
 
fred rosenberger
lowercase baba
Bartender
Posts: 12127
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
 
Mike Rainville
Ranch Hand
Posts: 36
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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: 36
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic