Results 1 to 16 of 16
Like Tree3Likes
  • 1 Post By Rahim2312
  • 1 Post By DarrylBurke
  • 1 Post By DarrylBurke

Thread: 'Javac' Not Recognized Error

  1. #1
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default 'Javac' Not Recognized Error

    I am attempting to write my 1st Java program, but when I try to run my program, I get this error
    'javac' is not recognized as an internal or external command operable program or batch file


    What am I doing wrong here? It's probably very simple, but I'm new and don't know :)
    mortm chase likes this.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: 'Javac' Not Recognized Error

    Change your system's path to include the directory that holds your javac.exe program.

  3. #3
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    How do I do that?

    If it helps, this is what I downloaded:

    http://www.oracle.com/technetwork/ja...s-1591156.html
    Last edited by Rahim2312; 04-30-2012 at 05:03 AM.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: 'Javac' Not Recognized Error

    You downloaded an HTML file?

    db
    Everyman likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: 'Javac' Not Recognized Error

    Everyman likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    Quote Originally Posted by DarrylBurke View Post
    You downloaded an HTML file?

    db
    No it's not an .html file...that is a link to the downloads page for the product I downloaded. And of course I chose Windows 7 64 bit then I got the actual file.

  7. #7
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error


  8. #8
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    If I SET the path location before I try to execute my java file it works, but when I tried to actually change the path following these instructions:
    To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

    Click Start, then Control Panel, then System.

    Click Advanced, then Environment Variables.

    Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:

    C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin


    It gave me the same error about javac not being recognized etc etc.

  9. #9
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: 'Javac' Not Recognized Error

    Look in Windows Explorer and get the actual path to the bin folder. If you downloaded the SDK recently, it won't be 1.7.0

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  10. #10
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    This is the location of my javac file

    C:\Program Files\Java\jdk1.7.0_04\bin

  11. #11
    wdh321 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    116
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    in command prompt type this

    set path=C:\Program Files\Java\jdk\bin

    obviously the file path will completely depend on where your file is stored, above is just an example.

  12. #12
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    My javac file is in the above path...the .java file I am trying to run is in a different path. Would it be easier if I just moved my .java file to C:\Program Files\Java\jdk1.7.0_04\bi

  13. #13
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: 'Javac' Not Recognized Error

    Quote Originally Posted by Rahim2312 View Post
    Would it be easier if I just moved my .java file to C:\Program Files\Java\jdk1.7.0_04\bi
    Never even think about doing that. And Windows 7 probably won't allow it, which is good.

    Copy your PATH variable and paste it here.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  14. #14
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    Whew, glad I asked before I tried it!

    My PATH variable from the Control Panel is:
    C:\Program Files\Java\jdk1.7.0_04\bin

    EDIT ---
    Missed the 1st part of my path variable
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sy stem32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShel l\v1.0\; C:\Program Files\Java\jdk1.7.0_04\bin
    Last edited by Rahim2312; 04-30-2012 at 05:04 PM. Reason: Missed the 1st half

  15. #15
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: 'Javac' Not Recognized Error

    Do you have a space before C:\Program Files\Java\jdk1.7.0_04\bin? You shouldn't.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  16. #16
    Rahim2312 is offline Member
    Join Date
    Apr 2012
    Posts
    88
    Rep Power
    0

    Default Re: 'Javac' Not Recognized Error

    Removing the space fixed it!! Thank you thank you!

Similar Threads

  1. Replies: 28
    Last Post: 06-10-2012, 04:48 AM
  2. 'javac' is not recognized
    By adm in forum New To Java
    Replies: 2
    Last Post: 01-31-2012, 10:24 AM
  3. Javac not recognized
    By OscarLiu in forum New To Java
    Replies: 8
    Last Post: 06-29-2010, 04:10 PM
  4. Javac is not recognized?
    By Java idiot in forum New To Java
    Replies: 4
    Last Post: 08-03-2009, 07:54 PM
  5. javac command not recognized
    By sunshine39 in forum New To Java
    Replies: 7
    Last Post: 03-04-2009, 04:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •