Code Enthusiastic
Code Enthusiastic

Reputation: 2847

Why the command 'java' is executed even when no path is set?

If the path is not set then the command `javac' in command prompt results in

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

Whereas the command java is successfully executed.

Platform: Windows XP

Upvotes: 1

Views: 981

Answers (3)

amicngh
amicngh

Reputation: 7899

If machine has JRE then java command will work once you get install whole jdk it contains path to javac.

If JRE is only installed then java.exe resides under PATH variable something like C:\Program Files (x86)\Java\jre1.6.0_43\bin thats why java works. try below command on command prompt.

 > echo %PATH%

Upvotes: 0

Joni
Joni

Reputation: 111299

If this is a Windows machine and you have installed the JDK, what's likely happening is that the installer places a copy of java.exe in a system directory that is included in PATH, such as in C:\WINDOWS\system32.

The installer does this so you may run Java programs without further setup. The compiler is not given the same treatment, not sure why.

Upvotes: 3

Ravi K Thapliyal
Ravi K Thapliyal

Reputation: 51711

Probably indicates that the machine has Java Runtime Environment (JRE) installed but not the JDK. javac and other Java development related programs like javadoc, jarsigner etc. are part of the Java Development Kit not JRE.

Upvotes: 3

Related Questions