1

I am confused here:
If I run java from cmd then the command runs succesfully.
But I have neither set JAVA_HOME nor %JRE_HOME% nor added java/jre installation directory in my PATH.
So when I do

echo %JAVA_HOME%

No JAVA_HOME is displayed (expected since I have not set it)

If I do:

echo %JRE_HOME%`

No JRE_HOME is displayed (expected since I have not set it)

and when I do

echo %PATH%

no directory in the PATH points to a java installation. Expected since I have not modified PATH to add java.

PATH is:

C:\Program Files\Common Files\Microsoft Shared\Windows Live;  
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;  
C:\Program Files (x86)\AMD APP\bin\x86_64;  
C:\Program Files (x86)\AMD APP\bin\x86;
C:\Windows\system32;C:\Windows;  
C:\Windows\System32\Wbem;  
C:\Windows\System32\WindowsPowerShell\v1.0\;  
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;  
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;   
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;  
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;  
C:\Program Files (x86)\IDM Computer Solutions\UltraEdit-32;  
C:\Program Files (x86)\Windows Live\Shared  

So why don't I get Bad Command on running java?
enter image description here

Cratylus
  • 49,824
  • 60
  • 195
  • 327
  • 1
    That snapshot seems like white ants crawling over black mat. No one can see a single letter there. So its no point in posting it. Rather write the path from where you are using that command. – Rohit Jain Oct 21 '12 at 21:03
  • The path where I run java is: `C:\Users` – Cratylus Oct 21 '12 at 21:04
  • What does echo %PATH% return to you? It doesn't appear on your snapshot. – Daniel Pereira Oct 21 '12 at 21:05
  • @DanielPereira:Can you see the snapshot?I see that RohitJain is right. I will put these in the OP. – Cratylus Oct 21 '12 at 21:06
  • It has to be in your `%PATH%`. – Andrew Logvinov Oct 21 '12 at 21:06
  • there is no result for echo %PATH%, can you write command SET, and look the value of Path. Java must be there, or C:\Users directory. – chrome Oct 21 '12 at 21:10
  • are you sure you don't have some sort of simlink to java in your users directory? – Jon Taylor Oct 21 '12 at 21:10
  • @JonTaylor:I have no idea what you are asking me, so I would say no – Cratylus Oct 21 '12 at 21:11
  • Well in your Users directory there may be a file which acts essentially as a pointer to the real java.exe file. This would negate the need for any path variables when working in the user directory. – Jon Taylor Oct 21 '12 at 21:12
  • Did you change the default Java install directory? Please, post the directory of your current Java version. – Daniel Pereira Oct 21 '12 at 21:13
  • @RohitJain there's nothing wrong with that screenshot, you just have to view the full-size image instead of the resized version SO shows you. Cratylus, did you install something that depends on Java and therefore installed Java on its own when it didn't find an existing installation? That could put it in an unexpected directory. Less likely, you could've added Java under an environment variable with a non-standard name, or perhaps directly in the `Users` directory. – Pops Oct 21 '12 at 21:14
  • Okay, I see the OP edited, so for convenience: [original screenshot](http://i.stack.imgur.com/zGzBr.png) and [updated screenshot](http://i.stack.imgur.com/6MScM.png) – Pops Oct 21 '12 at 21:18
  • @LordTorgamus:Used the `where` command as the answer by MartinElis (did not know about this) and it displayed: `C:\Windows\System32\java.exe`. Is this bundled in `Windows 7` or did I install it sometime in the past and did not remember this? – Cratylus Oct 21 '12 at 21:18
  • @Cratylus according to Joachim Sauer, [the `System32` directory is the (or a) new default location](http://stackoverflow.com/questions/8223511/how-to-prevent-that-java-exe-is-installed-in-windows-system32#comment10112260_8223511). – Pops Oct 21 '12 at 21:21

1 Answers1

9

According to this answer to "Is there an equivalent of 'which' on windows?", recent versions of Windows include a 'where' command.

So you could try: where java.exe

I can't check right now, but I have a feeling Windows had a java.exe somewhere under C:\Windows\System32\

Community
  • 1
  • 1
Martin Ellis
  • 9,263
  • 39
  • 53