Page 1 of 2 12 LastLast
Results 1 to 20 of 26
  1. #1
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default 'javac' is not recognized as an internal or external command...HELP!

    Hey guys,

    I'm trying to compile a program created in textpad through the cmd window. I saved the program, which I know is correct, to a folder called Java in my documents. I added C:\Program Files\Java\jdk1.6.0_24\bin; to the beginning of the PATH system variable, and the entire path says this:

    C:\Program Files\Java\jdk1.6.0_24\bin;%SystemRoot%\system32;% SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;%SYSTEMROOT%\System32\WindowsPow erShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Trend Micro\AMSP

    I don't know what I need to type in the cmd window to actually use this path, so I just cd to the exact location of where the program is saved. However! whenever I type javac MySecondProgram.java to actually compile the program, is says:

    'javac' is not recognized as an internal or external command, operable program or batch file

    What should I do? This is my personal laptop that runs Windows 7 btw. I attached a picture of my cmd window.

    Thanks for any help!
    Attached Thumbnails Attached Thumbnails 'javac' is not recognized as an internal or external command...HELP!-error.jpg  

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Where on the path you posted is the javac command?
    The OS is not finding the javac.exe file.
    You need to add the path to the folder containing the javac.exe file to the PATH variable.

    Or you can use the full path to the javac.exe when you execute it:
    C:\Java_SDK\bin\javac.exe Myprogram.java

    To show the path in a console window, enter PATH:
    D:\JavaDevelopment\Testing>path
    PATH=C:\Program Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDO WS\System32\Wbem;C:\Program Files\Java\jdk1.5.0_04\bin;C:\BatchFiles;C:\Progra m Files\Support Tools\;C:\WINDOWS\system32\WindowsPowerShell\v1.0; C:\Program Files\QuickTime\QTSystem\
    D:\JavaDevelopment\Testing>
    Note the backslashes are changed to vertical bars in the above
    Last edited by Norm; 05-29-2011 at 10:33 PM.

  3. #3
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    When you say the path I posted, do you mean in the picture or my path that I changed in the environmental variables?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    I can't see details in the attached image. I was refering to the inline text.

    What do you see in the console window? Right-click, select all, copy and paste here

  5. #5
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    In my cmd window when I type PATH it says:

    C:\>PATH
    PATH=C:\Program Files\Java\jdk1.6.0_24\bin;C:\Windows\system32;C:\ Windows;C:\Win
    dows\System32\Wbem;C:\Program Files (x86)\Common Files\Intuit\QBPOSSDKRuntime;C:
    \Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files (
    x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Fil
    es\Roxio Shared\DLLShared\;C:\Windows\System32\WindowsPower Shell\v1.0\;C:\Progra
    m Files (x86)\QuickTime\QTSystem\;C:\Program Files\Trend Micro\AMSP

  6. #6
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    Also, where should I be saving the programs to on my computer?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    The next obvious question is: Does the following file exist? What happens if you enter the following command?
    "C:\Program Files\Java\jdk1.6.0_24\bin\javac.exe"

  8. #8
    louboulos is offline Member
    Join Date
    Mar 2011
    Posts
    25
    Rep Power
    0

    Default

    In order for the javac to be recognized you have to navigate to your JDK folder using the "CD" command.

    i.e: For Windows 7 in my pc is : cd C:\Oracle\Middleware\jdk160_21\bin

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Build a new folder for your programs. Don't put it in the JDK folders.

  10. #10
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    Well, firstly there was no Java in the program files, but it was in the program files x86. But when I typed that command I got:

    C:\Program Files (x86)\Java\jdk1.6.0_24\bin>javac.exe
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files and annotati
    on processors
    -cp <path> Specify where to find user class files and annotati
    on processors
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -proc:{none,only} Control whether annotation processing and/or compil
    ation is done.
    -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
    o run; bypasses default discovery process
    -processorpath <path> Specify where to find annotation processors
    -d <directory> Specify where to place generated class files
    -s <directory> Specify where to place generated source files
    -implicit:{none,class} Specify whether or not to generate class files for
    implicitly referenced files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release

    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -Akey[=value] Options to pass to annotation processors
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system

  11. #11
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Is the path you used in the last post to the javac.exe file in the PATH variable?
    Looks like the PATH variable is wrong.

  12. #12
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    Quote Originally Posted by louboulos View Post
    In order for the javac to be recognized you have to navigate to your JDK folder using the "CD" command.

    i.e: For Windows 7 in my pc is : cd C:\Oracle\Middleware\jdk160_21\bin
    When I go directly through the bin and try to compile the program, it says:

    C:\Program Files (x86)\Java\jdk1.6.0_24\bin>javac MySecondProgram.java
    MySecondProgram.java:2: error while writing MySecondProgram: MySecondProgram.cla
    ss (Access is denied)
    public class MySecondProgram
    ^
    1 error
    C:\Program Files (x86)\Java\jdk1.6.0_24\bin>

    It says there is an error in the "C" in class, but I don't know how that is even possible haha. My professor was able to run the program on her computer, it just isn't allowing me to on mine.

  13. #13
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Is the path you used in the last post to the javac.exe file in the PATH variable?
    Looks like the PATH variable is wrong.
    Yes, it is I'm pretty sure. What do I need to change?

  14. #14
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    If, by some odd chance, the path actually is correct, where is the best place to save the program that I wrote on my computer? I just have it in a folder called Java in my documents.

  15. #15
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    For the OS to find a file, you need the path to the find to be in the PATH variable. Make sure the correct path to javac.exe is in the PATH variable.

    You can put your folder anywhere you want. In My Documents would be OK

  16. #16
    taymilll is offline Member
    Join Date
    May 2011
    Posts
    17
    Rep Power
    0

    Default

    I figured it out! Well, my professor did. I had to tweak my path and specify (x86) after program files. Thank you so much for all the replies and suggestions! I'm sure I will be back soon haha :)

  17. #17
    davion is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default

    Help,I also face the same error, I'm using windows xp.

    location for java installed is C:\Program Files
    environment variables
    classpath: C:\Program Files\Java
    java_home: C:\Program Files\Java
    path: C:\Program Files\Java\jdk1.6.0_25\bin;%SystemRoot%\system32;% SystemRoot%;%SystemRoot%\system32\WBEM

    when i run javac in the bin folder, it responded but when in the root folder, it state that 'javac' is not recognized as an internal or external command.I had run the command lines java -version and it shows the correct version of java installed.

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    C:\Program Files\Java\jdk1.6.0_25\bin
    Check that this value from what you show as in the PATH variable is correct.

    The install process puts the java.exe file in a Windows folder that is on the PATH

    location for java installed is C:\Program Files
    Check the above. It only show a partial path. How did you get the value that you show?
    Last edited by Norm; 05-30-2011 at 12:50 AM.

  19. #19
    davion is offline Member
    Join Date
    May 2011
    Posts
    4
    Rep Power
    0

    Default

    the install location is C:\Program Files\Java, type wrongly.

  20. #20
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 19
    Last Post: 11-27-2010, 12:31 AM
  2. Replies: 28
    Last Post: 10-26-2010, 04:39 AM
  3. Replies: 13
    Last Post: 09-17-2009, 07:56 AM
  4. Replies: 8
    Last Post: 11-18-2008, 09:21 AM
  5. 'javac' is not recognized as an internal or external command
    By sam_1032002@btopenworld.c in forum New To Java
    Replies: 3
    Last Post: 10-18-2008, 02:40 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
  •