Javac is not recognized as an internal or external command

Asked

Viewed 59,086 times

15

I am trying to compile a java class via command line (cmd), but I cannot, the error shown is:

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

Screenshot of the prompt with the error:

inserir a descrição da imagem aqui

I set the environment variables as follows:

JAVA_HOME: C:\Program Files\Java\jdk1.8.0_60

and

PATH:
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Windows Live\Shared;
C:\Users\7\AppData\Local\Smartbar\Application\;
C:\Users\7\AppData\Local\Smartbar\Application\;
C:\Users\7\AppData\Local\Smartbar\Application\;
C:\Program Files\Skype\Phone\
  • 1

    Are you trying to compile from the command line? put the command you executed.

  • by cmd , I tried but will not

  • Put the cmd command, the java code is inside some Packge?

  • is not in any package

  • 4

    What’s the bug? Edit your question and add the bug, and if you find it necessary, the code you made.

  • 1

    Nani good afternoon, @rray asked you to ask the question the command and the code you tried to compile, enter this data so that it is possible to understand what the problem is and to be able to help you :) See more.

  • posted the image

  • Now it’s improved. By the way the environment variables were not configured correctly or the cmd you ran was with the old settings.

  • I’ve already configured 4 times the environment variables '-'

  • Edit the question and put their value as text, in the image does not to see JAVA_HOME in PATH.

  • ready, but the path modified the change itself '-'

  • At the end of the PATH, add this: ;%JAVA_HOME%, ok and go confirming, close all cmd, open a new cmd and run javac or java --version.

  • 1

    when rodei javac was not, and java --version appeared the following message : error: could not to create java virtual machine

  • See this possible solution to this error here.

  • You installed the JDK for 32bit?

Show 10 more comments

1 answer

23

  1. Right-click on "My Computer" and then on estates.
  2. In the "Advanced" tab click on "Environment Variables".
  3. Under "System Variables" click on "New...", will open a little window for you...
  4. Under "Variable Name" type "JAVA_HOME"
  5. In "Variable Value" type the path where you installed JDK there top... in your case "C: Program Files Java jdk1.8.0_60". Ready, OK...
  6. Now in "User Variables" look for a variable called "PATH", if there is no click on "New...", or click on "Edit..."
  7. Who clicked on "New..." put as "Variable Name" the text "PATH" and as its value the text "%JAVA_HOME% bin
  8. Who clicked on "Edit..." add at the end of the variable value o text "; %JAVA_HOME% bin"
  9. Open a new command prompt and run javac
  • still not compiling x.x

  • With the same problem, I already tried to reinstall java and recreate the paths, but it continues to point out that java is not a valid command

Browser other questions tagged

You are not signed in. Login or sign up in order to post.