Results 1 to 12 of 12
  1. #1
    wayneluu91 is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Exclamation Can't use javac in command line (not recognized)

    i'm using jdk1.6.0_21 and i can't use javac to execute my java file in cmd . Actually , i can , but i have to put my java file in the same dir with javac.exe in "C:\Program Files\Java\jdk1.6.0_21\bin".Meanwhile,this guy(watch the video) , he can do " javac *.java" in cmd without putting them in the same dir , is there any way i can do like that ?


    v=zF7dfCkwZ5AYouTube - How To Compile A Java Program With Javac
    Last edited by wayneluu91; 08-05-2010 at 03:23 PM.

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

    Default

    Quote Originally Posted by wayneluu91 View Post
    i'm using jdk1.6.0_21 and i can't use javac to execute my java file in cmd . Actually , i can , but i have to put my java file in the same dir with javac.exe in "C:\Program Files\Java\jdk1.6.0_21\bin".Meanwhile,this guy(watch the video) , he can do " javac *.java" in cmd without putting them in the same dir , is there any way i can do like that ?


    v=zF7dfCkwZ5AYouTube - How To Compile A Java Program With Javac
    Put that bin directory in your PATH variable list (not CLASSPATH); this is not a Java thing, it is an OS thingie ...

    kind regards,

    Jos

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by wayneluu91 View Post
    i'm using jdk1.6.0_21 and i can't use javac to execute my java file in cmd . Actually , i can , but i have to put my java file in the same dir with javac.exe in "C:\Program Files\Java\jdk1.6.0_21\bin".Meanwhile,this guy(watch the video) , he can do " javac *.java" in cmd without putting them in the same dir , is there any way i can do like that ?


    v=zF7dfCkwZ5AYouTube - How To Compile A Java Program With Javac
    Or else set the path on command prompt (complete path) and try to compile the source bundle.

  4. #4
    wayneluu91 is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default

    hmm sr , but i don't get "PATH variable list (not CLASSPATH)" and i don't wanna set the path everytime i compile :D ,@ JosAH: sr but can you show me step by step to do that ?

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

    Default

    Quote Originally Posted by wayneluu91 View Post
    hmm sr , but i don't get "PATH variable list (not CLASSPATH)" and i don't wanna set the path everytime i compile :D ,@ JosAH: sr but can you show me step by step to do that ?
    If you can't see a variable (and its value) named 'PATH' you probably don't have it (which I sincerely doubt). On my little Windows 7 laptop I go to Control Panel > System > Advanced Settings > Environment Variables and set my PATH (it's a so called 'system variable'). It stays that way forever or until you change it again.

    kind regards,

    Jos

  6. #6
    wayneluu91 is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default

    Well , thank you so much ,it works perfectly .i've used comp for 7 years ,but i didn't know anything about that Environment Variables,and that's OS things :D .

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Study about system variables could be worth actually. And also by editing the autoexec.bat file you can achieve the same, but you must edit the file carefully. If it's damage you may need to reinstall your OS.

    Mean time if you are satisfied with the answer please mark the thread solved.

  8. #8
    wayneluu91 is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default

    thank for your suggestion .

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  11. #11
    wayneluu91 is offline Member
    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0

    Default

    it seems interesting to me , every knowledge is useful ,thank you

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 28
    Last Post: 10-26-2010, 05:39 AM
  2. javac is not recognized command...
    By javastudent87 in forum New To Java
    Replies: 6
    Last Post: 07-30-2010, 06:50 AM
  3. Replies: 13
    Last Post: 09-17-2009, 08:56 AM
  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
  •