Results 1 to 16 of 16
  1. #1
    MithunDhar is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Unhappy [SOLVED] javac problem

    I am using Win Vista. I have downloaded Java 6 and installed it properly. But I cannot find the Javac file in bin folder of program file. And becuase of this I am receiving an error message while compiling a java program as 'Javac is not recognised as external or internal ........". In fact, when I write a java program in bin folder, even though it is saved there, but the file cannot be seen there. So, can anyone have a solution to that problem?

  2. #2
    subb is offline Member
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default

    I think you need to install the JDK for that.

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    What "bin" folder?

    jdk/bin or jre/bin.

    If all you have is the second, then you have downloaded the JRE, and you need to download the JDK. And, don't save anything in the "bin" folder. On Vista, trying to save into the "bin" folder, probably redirected the save into a folder in your home directory, but that is not the reason you don't want to save there. You actually don't want to save there because you have no business saving anything there.

    As far as "javac not recog....", set your PATH (not CLASSPATH).

  4. #4
    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

    Java Downloads.

    Download the JDK(Java Development Kit) newer version from the above link and install first. Then you have to setup the class path.

    Classpath setup on XP

    The above page may help you.

  5. #5
    gentlesweet20 is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default Being illuded by a simple task

    I am trying to add up the numbers in an array recursively but its not working can someone please look at my code and tell me whats wrong

    thanks

    class RecursiveArray{
    public static void main(String args[]){

    int array[]=new int[]{3,4,5,6,7};
    System.out.print(arraySummation(array[]));
    }

    public static int arraySummation(int[] a){
    int result=0;
    int i=0;
    if(i<a.length){
    result=a[i]+arraySummation(a[i++]);
    }
    return result;
    }
    }

  6. #6
    Mara is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    look enter your Sun folder and see were you have the jdk folder, its probable that it goes something like this:

    C:\Sun\SDK\jdk\bin

    then instead of putting on the cmd "javac" put
    bin folder\javac HelloWorld.java

    example:
    C:\Sun\SDK\jdk\bin\javac HelloWorld.java

    it works for me

  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

    Quote Originally Posted by gentlesweet20 View Post
    I am trying to add up the numbers in an array recursively but its not working can someone please look at my code and tell me whats wrong

    thanks

    class RecursiveArray{
    public static void main(String args[]){

    int array[]=new int[]{3,4,5,6,7};
    System.out.print(arraySummation(array[]));
    }

    public static int arraySummation(int[] a){
    int result=0;
    int i=0;
    if(i<a.length){
    result=a[i]+arraySummation(a[i++]);
    }
    return result;
    }
    }
    Please don't interact with others thread if your question is not related to the original question. Choose the correct sub-forum and post your question there more clearly. Please read our FAQ page as well. It's really helpful to you. Good luck!

  8. #8
    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 Mara View Post
    look enter your Sun folder and see were you have the jdk folder, its probable that it goes something like this:

    C:\Sun\SDK\jdk\bin

    then instead of putting on the cmd "javac" put
    bin folder\javac HelloWorld.java

    example:
    C:\Sun\SDK\jdk\bin\javac HelloWorld.java

    it works for me
    But it depends. Sometime JDK installation path is something like this.

    C:\jdk1.5
    What I want to say is, in the installation you can exactly find the location. Check on the bin folder. As we explain in the above he may be install the JRE, not JDK/SDK.

  9. #9
    MithunDhar is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    I installed the JDK and install it outside the program files in C directory. While installing, it did not copied the javac file into the bin folder. I set the classpath, but it still showing that javac not recognised. Can anyone resolve this problem or is there any other way to practice java? (Windows Vista)

  10. #10
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    can you make sure you have instaled JDK and not JRE.
    also, please post your PATH and CLASSPATH.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  11. #11
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by MithunDhar View Post
    I installed the JDK and install it outside the program files in C directory. While installing, it did not copied the javac file into the bin folder. I set the classpath, but it still showing that javac not recognised. Can anyone resolve this problem or is there any other way to practice java? (Windows Vista)
    I explicitly said "PATH not classpath". Also, if you installed the JDK it did to "copied the javac file into the bin folder". Guaranteed.

    Now, where, exactly, did you install it? Not just "outside the program files in C directory", that is 99% of your system.

  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

    Default

    Quote Originally Posted by MithunDhar View Post
    I installed the JDK and install it outside the program files in C directory. While installing, it did not copied the javac file into the bin folder. I set the classpath, but it still showing that javac not recognised. Can anyone resolve this problem or is there any other way to practice java? (Windows Vista)
    Can you show your installation path?

    As masijade says, there is no such error on JDK installation. Not even on Vista.

  13. #13
    MithunDhar is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    There was a installation problem. Its ok now. Thank you.

  14. #14
    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

    It's better if you can explain what the issue is and how did you overcome it. May be your explanation can be helpful to someone else who has the same issue like you. :)

    And also, if you've solved the problem please mark the thread solved.

  15. #15
    MithunDhar is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default Method Overriding

    Can anyone detect the error in this program:

    class figure
    {
    double sidea,sideb;
    figure(double a,double b)
    {
    sidea=a; sideb=b;
    }
    figure(double a)
    {
    sidea=a; sideb=a;
    }
    double area()
    {
    System.out.println("Area inside class is undefined");
    return 0;
    }
    }
    class rectangle extends figure
    {
    rectangle(double a,double b)
    {
    super(a,b);
    }
    double area()
    {
    System.out.println("Area of rectangle is "+(sidea*sideb));
    }
    }
    class square extends figure
    {
    square(double a)
    {
    super(a);
    }
    double area()
    {
    System.out.println("Area of square is "+(sidea*sideb));
    }
    }


    class overriding
    {
    public static void main(String args[])
    {
    figure f=new figure(34,20);
    System.out.println("Welcome of Overriding Demo");
    f.area();
    rectangle r=new rectangle(20,40);
    r.area();
    square s=new square(21);
    s.area();
    }
    }

  16. #16
    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. javac command not recognized
    By sunshine39 in forum New To Java
    Replies: 7
    Last Post: 03-04-2009, 04:54 AM
  2. excludes in javac target
    By ziggy in forum New To Java
    Replies: 2
    Last Post: 11-25-2008, 05:29 AM
  3. javac?
    By sardare in forum Eclipse
    Replies: 1
    Last Post: 06-14-2008, 03:06 AM
  4. javac DOS
    By rdunne in forum New To Java
    Replies: 3
    Last Post: 01-01-2008, 12:49 PM
  5. Help with javaC
    By Daniel in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 03:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •