Error 'javac' is not recognized as an internal or external command


#1

I get this error when I try to run a script. I know the location of the JDK in the Java bin folder, but what do I do so that I don’t get this error?

I have this path C:\Program Files\Java\jdk1.8.0_101\bin
Can I use this path to direct Atom to so I don’t get this error?

Thanks in advance


#2

When you’re asking a question about a package, it’s important to be specific about the name of the package. There may be multiple packages that compile Java and they might work differently.

Fortunately, your issue is not a package problem. You need to go to Control Panel -> System -> Advanced System Settings -> Environment Variables. In the bottom panel, locate and select Path, click on Edit, and then Add a new entry, with the text C:\Program Files\Java\jdk1.8.0_101\bin. Close the Atom application completely and reopen it and you should be able to compile things just fine. You can verify that the command works by typing javac into the command prompt. If it works, it will give you a bunch of lines of help for how to use the command.


#3

Hi, I’m pretty new to coding and just started learning Java. I downloaded Atom as a recommended text editor.

I have managed to find the window Enviroment Variables and I have the path for this JDK C:\Program Files\Java\jdk1.8.0_101\bin but what do I put as the ‘Variable name’?


#4

I’ve done it now. I had to edit ‘PATH’ not create a new one.

Thanks for your help


#5

No problem. :slight_smile:


#6

I had the same problem and this worked, but only in the command line. It still says the same thing in Atom.


#7

Have you restarted Atom? If so, open a terminal inside Atom (using a package like termination or atom-ide-ui) and run the command echo %PATH%. Then run that again outside of Atom and you should see what the difference is.


#8

So this is what happens when I do that and then try to run the program. I am able to run python programs just fine but for some reason java ones do this. it also did the cmd thing when i tried to run a C++ program.


#9

Sorry, I forgot that PowerShell has weird syntax. Open termination and run cmd to get to the normal shell. Like this:

Then open a cmd window from outside of Atom and run the same command. Finally, compare the output to see if anything is different.