0

I'm new to coding and javac is not recognized. I read that I need to change my path, but what I tried didn't work. My current path is: 'C:\Program Files\Java\jre7\bin'. What's wrong?

Roman C
  • 49,761
  • 33
  • 66
  • 176

2 Answers2

5

JRE is different from JDK. You need JDK in class path to compile program.

Set JAVA_HOME as C:\Program Files\Java

Assuming you have JDK inside Java folder. You will see javac inside C:\Program Files\Java\jdk...\bin

kosa
  • 65,990
  • 13
  • 130
  • 167
  • 2
    +1, but (and I'm aware the answerer doesn't allude to it), but I have reservations on adding a particular JDK version to your PATH. This is because when you update your JDK, you need to remember to update PATH to point to the new binaries. Recipe for difficult debugging. – Bathsheba Sep 20 '13 at 20:19
  • @Bathsheba: I agree with you, but I prefer not having multiple versions, if you are new to Java world. – kosa Sep 20 '13 at 20:20
  • thanks for the fast reactions! – user2800605 Sep 20 '13 at 20:26
  • so i should change JAVA_HOME? – user2800605 Sep 20 '13 at 20:26
  • I would start from there. – kosa Sep 20 '13 at 20:27
  • where can i change it? – user2800605 Sep 20 '13 at 20:28
  • @user2800605: http://stackoverflow.com/questions/2619584/how-to-set-java-home-on-windows-7 – kosa Sep 20 '13 at 20:29
  • okay, step 6 is: Enter the variable value as the installation path for the Java Development Kit – user2800605 Sep 20 '13 at 20:30
  • to be honest, i got to: Set the JAVA_HOME Variable Once you have the JDK installation path: Right-click the My Computer icon on your desktop and select Properties. Click the Advanced tab. Click the Environment Variables button. Under System Variables, click New. Enter the variable name as JAVA_HOME. Enter the variable value as the installation path for the Java Development Kit. Click OK. Click Apply Changes. – user2800605 Sep 20 '13 at 20:33
  • i dont understand whats above btw – user2800605 Sep 20 '13 at 20:33
  • Okay, i managed to set JAVA_home to C:\Program Files\Java\jdk1.7.0_40. What's next? – user2800605 Sep 20 '13 at 21:04
  • i did some research and i figured it out myself! If anyone wants to know: my JAVA_HOME = C:\Program Files\Java\jdk1.7.0_40 and my path = %JAVA_HOME%\bin – user2800605 Sep 20 '13 at 21:26
  • @user2800605: Good luck! that is all you need, little bit research instead of worrying too much about the problem. – kosa Sep 21 '13 at 13:51
0

JRE is different from JDK. You need JDK in class path to compile program.

Set JAVA_HOME as C:\Program Files\Java

Assuming you have JDK inside Java folder. You will see javac inside C:\Program Files\Java\jdk...\bin

By @Nambari

And next increment on PATH variable the real path of jdk\bin, like:

PATH = *old paths*\;C:\Program Files\Java\jdk...\bin.

Hope it helps. ^^ (Sorry guys, i use the blackquote to indicate the @Nambari answer couse i'he no suficient reputation do comment)

Cold
  • 787
  • 8
  • 23