tags:

views:

156

answers:

8

I downloaded this:

Java platform JDK

http://java.sun.com/javase/downloads/index.jsp

and installed it.

But when i go to the command prompt to check the version, it says it's not recognized

anyone else experiencing this issue with the latest Java?

i might not have installed the right thing. i need the java that works with grails:

http://www.grails.org/Installation

C:\>java
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\>

when i do a search on my computer for java, it does not find anything

+6  A: 

Is the -version flag not recognized, or is the "java" command not recognized? One way to test this is just to type 'java' by itself and run it and see what happens.

If the command is not recognized, make sure that the JDK's install path is in your windows PATH. If not, you won't be able to use any of the java executables from the command prompt. Here's another link that may help out.

JasCav
im not finding java at all on my computer, but when i run installation again it says that it's installed
I__
@every_answer_gets_a_point - Read the install path document I linked in my answer. It explains the problem that you are having.
JasCav
+2  A: 

You most likely don't have java.exe in your system's PATH variable.

mbaird
im not finding java at all on my computer, but when i run installation again it says that it's installed
I__
It's either in "C:\Program Files\Java" or "C:\Program Files (x86)\Java" depending on the version of Windows you are running and the version of Java you installed.
mbaird
+1  A: 

You installed the JDK. Isn't java.exe part of the JRE? Do you have that installed?

Melvin
you might be right, which version do i need for grails: http://www.grails.org/Installation ?
I__
java.exe is part of the JDK, too, and a JRE is usually installed as part of the JDK.
wsorenson
+2  A: 

For Linux:

check $PATH and $JAVA_HOME. You can configure it in /etc/environment

From console you can check it like:

$ echo $PATH

For Windows:

My Computer -> Properties -> Advanced -> Environment Variables Check there PATH.

From console you can check it like:

echo %PATH%
Alex Ivasyuv
+2  A: 

Press simultaneously the "windows" and "pause" buttons on your keyboard, this will bring up the System Preferences dialog. In the Advanced tab, find Environment Variables.

Then, in the User (upper) section, create or update the following two variables :

  • JAVA_HOME = where you put your JDK, eg. C:/Java/SDK
  • PATH = %JAVA_HOME%/bin

Close the dialogs.

Then, in a new command-line console, try "javac -version" and see if it's detected. It's important that you use a new console, because environment variables are read only when the console is launched.

Olivier Croisier
Windows+Pause, cool, didn't know that
Bart van Heukelom
+2  A: 

You need to manually add the path to javac.exe and java.exe to your operating system path. The Java installation program doesn't do that for you.

John Topley
+3  A: 

Java is typically installed (on Windows) as C:\Program Files\Java\jdk<version>

That installation directory has a subdirectory bin which you need to append to your PATH environment variable via the control panel. Then, the commands like java, javac etc. will be available on the command line.

BTW, the same is true for Grails.

Michael Borgwardt
+1  A: 

You should have a Java icon in Windows Control Panel. Locate the Java tab and click the View button. That will show you the path to the Java executables.

Last but not least, make sure you have restarted the computer so changes in the PATH variable can take effect.

Álvaro G. Vicario
You don't need to restart the computer, just open a new command window. Or you can always just issue a "set PATH=C:\path\to\java;%PATH%" to update the path in your current window.
TMN
That's fine to use Java from the command line but he probably wants to use Java from another tool.
Álvaro G. Vicario