Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2010
    Posts
    17
    Rep Power
    0

    Default How to compile java program in other than bin directory

    i have 4 drives on my pc
    c,d,e,f:
    i saved my program in C:\Program Files\Java\jdk1.6.0\bin ,it compile well and run too.
    when i try to save my program in a folder named(amrit) in other drive such as e,and when to compile it as
    cd \
    e:
    cd amrit
    javac nameoffile.java
    it give me following error
    "javac is not recongized as internal or external command ,operable program or batch file"



    Help me solve it
    Thanks

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

    Default

    Quote Originally Posted by amritpalpathak View Post
    i have 4 drives on my pc
    c,d,e,f:
    i saved my program in C:\Program Files\Java\jdk1.6.0\bin ,it compile well and run too.
    when i try to save my program in a folder named(amrit) in other drive such as e,and when to compile it as
    cd \
    e:
    cd amrit
    javac nameoffile.java
    it give me following error
    "javac is not recongized as internal or external command ,operable program or batch file"
    This not a Java issue; your shell (cmd.exe) has to know where it has look for executable files (such as javac.exe). You have to set your 'path' environment variable so that it contains your bin directory where javac.exe file is stored. Check your operating system help system.

    kind regards,

    Jos

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

    Default

    One quick solution

    just add C:\Program Files\Java\jdk1.6.0\bin into you path environment system variable

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

    Default

    Another solution is to use the full path to the javac and java commands so the OS can find the programs:
    C:\Program Files\Java\jdk1.6.0\bin\javac AProgram.java

Similar Threads

  1. Teach Me Pls How To Compile Java Program Using CMD
    By Lilsimple in forum Java Applets
    Replies: 1
    Last Post: 03-11-2010, 05:26 PM
  2. Replies: 11
    Last Post: 02-08-2010, 01:15 AM
  3. My Java program will not compile and run?
    By sabrown311313 in forum Java Applets
    Replies: 1
    Last Post: 09-23-2008, 10:38 AM
  4. Program Won't Compile
    By JavaLovenJoe in forum New To Java
    Replies: 2
    Last Post: 04-22-2008, 02:31 PM
  5. Replies: 0
    Last Post: 01-30-2008, 11:04 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
  •