• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't run java programs??

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded java version 6 update 5 and then tried to compile my code but it spits back 'javac' is not recognized as an internal or external command, operable program or batch file. Any ideas?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make sure that the bin directory in included in your PATH. Under Windows, right-click My Computer, Properties -> Advanced -> Environment Variables (not sure about English menu names). At the bottom, look for PATH, and add the sdk bin directory to it and click OK. Open a new command prompt and try again.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One slight improvement on that.

Create a new environment variable called JAVA_HOME and set it to the path to your JDK, without the bin folder (e.g. C:\jdk1.6.0_05 or C:\Program Files\jdk1.6.0_05). The change the PATH variable as Christophe said, but instead of adding the JDK bin folder, add it as follows: "%JAVA_HOME%\bin" (include the quotes).

That way, not only is your environment set up for a possible future installation of other tools such as Apache Ant, but it also allows you to change the much shorter value of JAVA_HOME instead of the long PATH when you upgrade to another version. Remember, PATH includes many paths, and the JDK could be somewhere in the middle.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob for the addon. I'm also using the %JAVA_HOME% variable to set the PATH, as I have several versions installed on my machine.
 
reply
    Bookmark Topic Watch Topic
  • New Topic