Results 1 to 5 of 5
  1. #1
    iDGames is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default HelloWorldApp Error

    Hey there!

    I decided to give programming with Java a go and the first thing I wanted to do was this: "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)
    However, when I was about to compile my first file by typing javac HelloWorldApp.java I receive this error:
    "'javac' is not recognized as an internal or external command, operable program or batch file"

    According to the Common Problems Lesson I simply need to tell Windows where to find javac. In my case the directory would be:
    C:\Program Files\Java\jdk1.7.0_04\bin\javac

    But as soon as I precede javac with this directory I get the exact same message again.

    Here's my Command Prompt log:
    Java Code:
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    
    C:\Users\iDGames>cd C:\Users\iDGames\Desktop\Java
    
    C:\Users\iDGames\Desktop\Java>dir
     Volume in drive C has no label.
     Volume Serial Number is D416-C70F
    
     Directory of C:\Users\iDGames\Desktop\Java
    
    27.05.2012  15:26    <DIR>          .
    27.05.2012  15:26    <DIR>          ..
    27.05.2012  15:09               255 HelloWorldApp.java
                   1 File(s)            255 bytes
                   2 Dir(s)  310.412.894.208 bytes free
    
    C:\Users\iDGames\Desktop\Java>javac HelloWorldApp.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\Users\iDGames\Desktop\Java>C:\Program Files\Java\jdk1.7.0_04\bin\javac HelloW
    orldApp.java
    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\Users\iDGames\Desktop\Java>
    Any help is appreciated!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: HelloWorldApp Error

    Quote Originally Posted by iDGames View Post
    According to the Common Problems Lesson I simply need to tell Windows where to find javac. In my case the directory would be:
    C:\Program Files\Java\jdk1.7.0_04\bin\javac
    That is not a directory, that is the name of the file itself (without an extension).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    iDGames is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: HelloWorldApp Error

    Quote Originally Posted by JosAH View Post
    That is not a directory, that is the name of the file itself (without an extension).

    kind regards,

    Jos
    You're right about that. But the sample solution to compile the HelloWorldApp.java file is:
    C:\jdk1.7.0\bin\javac HelloWorldApp.java

    Wouldn't the equivalent for me be:
    C:\Program Files\Java\jdk1.7.0_04\bin\javac HelloWorldApp.java
    ?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,015
    Blog Entries
    7
    Rep Power
    20

    Default Re: HelloWorldApp Error

    Quote Originally Posted by iDGames View Post
    You're right about that. But the sample solution to compile the HelloWorldApp.java file is:
    C:\jdk1.7.0\bin\javac HelloWorldApp.java

    Wouldn't the equivalent for me be:
    C:\Program Files\Java\jdk1.7.0_04\bin\javac HelloWorldApp.java
    ?
    No; MS Windows is quite funky when it comes to spaces in a file path; for one thing, that shell (cmd.exe) chokes on it. Better put that directory in a PATH variable and never think about it anymore.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    anuvb1911 is offline Member
    Join Date
    May 2012
    Posts
    1
    Rep Power
    0

    Default Re: HelloWorldApp Error

    In the My Compute Settings,goto Advanced and click on Environment Variables.If a variable named PATH already exists then add a semicolon to its end and the add "C:\Program Files\Java\jdk1.7.0_04\bin" (without the quotes) to it and click OK.If no PATH variable is present,then just click on New and put the same Location and click OK

Similar Threads

  1. Replies: 10
    Last Post: 02-02-2012, 08:26 PM
  2. Replies: 29
    Last Post: 02-02-2012, 08:23 PM
  3. Replies: 10
    Last Post: 03-16-2011, 05:43 AM
  4. Help with compiling HelloWorldApp
    By JonBrad in forum New To Java
    Replies: 13
    Last Post: 01-09-2010, 04:04 PM
  5. Replies: 1
    Last Post: 12-05-2009, 07:28 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
  •