Results 1 to 9 of 9
  1. #1
    OscarLiu is offline Member
    Join Date
    Jun 2010
    Posts
    3
    Rep Power
    0

    Default Javac not recognized

    Hello everyone, I'm a newbie to Java;), just started a course last week and ya~ having a classical trouble trying to make javac run on my home machine.

    so when I type "javac *.java" in the command prompt, I get " 'javac' is not recognized as an internal or external bla bla bla..." I have looked around for solutions and typed other pieces of command and here's the results:

    C:\>java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HostSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

    C:\>echo %path%
    C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32 \Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.6.0_20\bin

    so it looks like the path is correct (my java sdk is indeed in that directory, and there is a javac.exe in the bin folder). I don't know what else can be wrong... I actually installed java sdk twice: after doing it once and then javac doesnt work, I restarted... tested again... and then reinstalled it (without manually uninstalling because I didn't find an unstall.exe) (the install.exe did ask "are you reinstalling?" and I assume it takes care of deleting duplicated files and setting all variables correctly).

    Please help!
    Thanks

    btw I'm using windows xp
    Last edited by OscarLiu; 06-29-2010 at 08:01 AM.

  2. #2
    OscarLiu is offline Member
    Join Date
    Jun 2010
    Posts
    3
    Rep Power
    0

    Default

    okay... I seem to have found where the problem is... but the way I tried to fix it doesn't work:

    so when I type "echo %path%" what comes out is different, the java bin directory returned in the command prompt is "C:\Program Files\Java\jdk1.6.0_02\bin" which is something I copied from my course website ealier (and different from the real java version i have).
    So when I try to change that from control panel -> systems -> advanced -> environmental variables -> path, my "echo %path%" command will always return the same list of directories I had, so it looks like editing the environmental variables from the control panel no longer works on my computer... ... Can someone tell me another way to set it? I think all I need to do is to change that 02 to a 20

  3. #3
    OscarLiu is offline Member
    Join Date
    Jun 2010
    Posts
    3
    Rep Power
    0

    Default

    phew.... okay guys... it seems like restarting the cmd window after changing the setting in the control panel will give the correct result and javac works now... that was a lot of me typing my own story here lol~

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

    Default

    Quote Originally Posted by OscarLiu View Post
    phew.... okay guys... it seems like restarting the cmd window after changing the setting in the control panel will give the correct result and javac works now... that was a lot of me typing my own story here lol~
    What I still find strange is that java.exe works (as you have shown us in your orignal post) but javac.exe doesn't while they are both stored in the same directory. If everything works now consider the previous behaviour MS voodoo ;-)

    kind regards,

    Jos

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,618
    Rep Power
    25

    Default

    The JDK install process copies java.exe to one of the Window's folders that is on the PATH.
    So java.exe would work but javac.exe wouldn't be found until the user sets the PATH.

    Do a Search for java.exe to see.

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

    Default

    Quote Originally Posted by Norm View Post
    The JDK install process copies java.exe to one of the Window's folders that is on the PATH.
    So java.exe would work but javac.exe wouldn't be found until the user sets the PATH.

    Do a Search for java.exe to see.
    I just checked it and indeed java.exe is copied to a windows directory; I didn't know that; thanks for the info.

    kind regards,

    Jos

  7. #7
    ujjal.ruet is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default Follow these steps given below:

    1.Keep your code (code.java) in the given path
    C:\Programs files\Java\Jdk..\bin\code.java

    2.Search cmd.exe
    3.copy cmd.exe to the path
    C:\Programs files\Java\Jdk..\bin\cmd.exe

    4.Double click on cmd.exe

    5.See that path is specified to the bin

    6.write---javac code.java
    7.PRESS ENTER
    8.if there is no error write---
    java code
    9.Press ENTER
    10.Now it will works...

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,123
    Rep Power
    20

    Default

    Copying code into the java bin directory?
    Might I suggest to anyone thinking that that is a good idea not to actually do it.
    You'll end up with a complete mess in there...never mind copying cmd.exe there as well.

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

    Default

    Quote Originally Posted by Tolls View Post
    Copying code into the java bin directory?
    Might I suggest to anyone thinking that that is a good idea not to actually do it.
    You'll end up with a complete mess in there...never mind copying cmd.exe there as well.
    Some people have developed strange habits ... this must've been the result of not reading and not understood tips from others.

    kind regards,

    Jos

Similar Threads

  1. Replies: 28
    Last Post: 10-26-2010, 05:39 AM
  2. Replies: 13
    Last Post: 09-17-2009, 08:56 AM
  3. Javac is not recognized?
    By Java idiot in forum New To Java
    Replies: 4
    Last Post: 08-03-2009, 07:54 PM
  4. javac command not recognized
    By sunshine39 in forum New To Java
    Replies: 7
    Last Post: 03-04-2009, 04:54 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, 03: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
  •