0

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" .

Community
  • 1
  • 1

5 Answers5

3

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.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
  • you are right ... thanks ..JDK is installed but I had removed the bin folder from "path" variable so "javac" is throwing error.I wanted to know that why "java" still running even though I had no link to bin folder of JDK and I got my answer .Big Thanks to you – Rishi Kumar Apr 23 '15 at 08:14
1

Java may be executed from the JRE that is installed in another path of your system.

Javac is part of the JDK, so you should install it, and set the appropriate paths.

andreadi
  • 1,953
  • 1
  • 20
  • 35
0

You need to install Java Development Kit (JDK) which provides javac to compile your java code. You have the Java Runtime Environment (JRE) which is mainly for running java programs.

This question may help: javac : command not found

Community
  • 1
  • 1
0

I think your 'Path'-variable is only used for javac.

Java-configuration in windows can be found here: Explanation on java.com

TVH
  • 1
0

Most probable issue could be that you are using JRE instead of JDK.

When you download java you can get it either as jre(Java Runtime Environment) or jdk(Java Development Kit) .

If you just want to run java programs on a machine , install JRE.

if you want to develop , compile and run a java program install JDK.

Both can be downloaded from oracle.Link for JDK 1.6

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR

Raj
  • 1,945
  • 20
  • 40