Mikey
Mikey

Reputation: 365

Getting javac to work in the PATH environment variable

So I've downloaded the latest JDK and installed it. I'm starting to go through a textbook with some tutorials but in no part of the textbook do they tell you how to 'setup' the javac compiler. If I type 'javac' into the command line it simply says it is not a recognised command. I have added the path of the bin folder to the path environment variable but it still says not a recognised command. Please help!!

Upvotes: 0

Views: 12125

Answers (4)

user3054142
user3054142

Reputation: 66

Javac is sitting in the bin directory contained in the area where your java compiler and interpreter were installed. So, assuming the path to bin is C:.....\bin, type set path=%path%;C:.....\bin at the command prompt.

Upvotes: 0

AdamL
AdamL

Reputation: 13191

Did you happen to modify PATH variable through command set PATH=%PATH%;C:\path\to\java\ ? If so, the PATH variable is not permanently stored yet. Use setx PATH "%PATH%;C:\path\to\java\" instead, and check if it was added by echo %PATH%, and check again in new cmd window. I had almost the same problem; I don't know the difference between set and setx, but the former didn't work for me, too :).

Upvotes: 0

Vusa
Vusa

Reputation: 21

  • Check if running javac works from within its folder.
  • echo %JAVA_HOME% and make sure it points to the right folder.
  • echo %PATH% and make sure it includes the right path.

Upvotes: 0

Gambotic
Gambotic

Reputation: 824

try to use the direct path to the javac like c:/swd/jdk/

Upvotes: 0

Related Questions