-1

I have added the below to the environment variables path C:\Program Files (x86)\Java\jre1.8.0_25. According to Google that's what was needed, but it still isn't working. I have attached a screenshot of exactly that

screenshot

I just want to try and run my java code from the cmd line. Any ideas on what I am doing wrong?

Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
  • What directory did you install Java into? – Dawood ibn Kareem May 20 '18 at 21:27
  • I'm not sure how it works on Windows, but I'm somehow missing `\bin`. Also, it would be interesting to see the output of `dir C:\Program Files (x86)\Java`. – Andrey Tyukin May 20 '18 at 21:27
  • 1
    You need JDK, and maybe `C:\Program Files (x86)\Java\jre1.8.0_25` – Am_I_Helpful May 20 '18 at 21:28
  • https://stackoverflow.com/questions/32241179/setting-up-enviromental-variables-in-windows-10-to-use-java-and-javac Just check this out. – spectral May 20 '18 at 21:28
  • 1
    One: Prefer 64-bit Java on 64-bit Windows; Two: You need a JDK - not a JRE; Three: You need the "bin" folder; Four: You should install a more recent version (1.8 is up to [8u172](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)). – Elliott Frisch May 20 '18 at 21:31
  • Also check the order of the `Path` entries. Your path to the *JDK/bin* should be above all other java related entries. Else you risk that Windows still uses the other entry for the `java` command. – Zabuzard May 20 '18 at 21:46

1 Answers1

1

javac is not included in the JRE; you will need to download a JDK distribution. After you have eg. the JDK 1.8.60, you can add C:\Program Files\Java\jdk1.8.0_60\bin to your PATH variable and javac will be available from the command line.

Daniele
  • 2,672
  • 1
  • 14
  • 20