My question looks similar to java-comand-works-but-not-javac but its different from the way that I deliberately had removed java bin directory from "path" variable and "JAVA_HOME" so that "java" and "javac" shouldn't be executed without giving full path to "javac" or "java".But still "java" is getting executed. For "javac" it is throwing 'javac' is not recognized as an internal or external command,
operable program or batch file.
But for "java" it is showing C:\Users\Nandi_Gaurav>java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
I want to know the reason. I am using "Windows-7" .
If the problem is that java
running when you don't expect it to1, open up a cmd
window and execute:
C:\USERS\Nandi_Gaurav\Documents>where java
C:\Windows\System32\java.exe
You'll almost certainly see that there's one installed in the Windows system directory.
That's why it's still executing even though you think you've removed it from the path.
If you really want to get rid of it, either delete it (assuming it's still available in the JRE/JDK directory) or rename it to something like nojava.exe
.
Whatever you do, don't remove c:\windows\system32
from your path, that'll cause all sorts of issues :-)
1 Your problem may also be that javac
is not running, in which case the JDK may not be installed. However, based on your question, that doesn't seem to be the issue - you're more concerned about things running when you've tried to disable them, rather than with things not running when they should be.