Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: My first program

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My first program

    class First
    {
    public static void main(string k[])
    {
    system.out.println("This is my first java program");
    }
    }
    Saved file as First.java
    when i am compiling javac First.java
    i am getting error
    javac: File Not Found: First.java
    Usage: javac <options><sourcefiles>


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: My first program

    Can you do a "dir" command in that directory, and post the results here?

    Also: Java is case-sensitive. System != system.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My first program

    Quote Originally Posted by KevinWorkman View Post
    Can you do a "dir" command in that directory, and post the results here?

    Also: Java is case-sensitive. System != system.
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\ANJIANU>dir
    Volume in drive C has no label.
    Volume Serial Number is F20A-0874

    Directory of C:\Users\ANJIANU

    09/23/2014 07:50 AM <DIR> .
    09/23/2014 07:50 AM <DIR> ..
    10/16/2012 04:16 AM <DIR> .gconf
    10/16/2012 04:29 AM <DIR> .gconfd
    10/16/2012 04:15 AM <DIR> .gnome2
    10/16/2012 04:15 AM <DIR> .gnome2_private
    10/16/2012 04:29 AM <DIR> .gnucash
    09/23/2014 07:50 AM <DIR> .jmc
    11/23/2012 08:41 AM 1,024 .rnd
    08/11/2014 08:05 PM <DIR> Contacts
    09/22/2014 05:31 AM <DIR> Desktop
    03/08/2012 08:41 AM 483 Desktop.lnk
    08/21/2014 11:27 PM <DIR> Documents
    09/23/2014 08:18 AM <DIR> Downloads
    08/11/2014 08:05 PM <DIR> Favorites
    10/14/2013 12:48 AM <DIR> Google Drive
    08/11/2014 08:05 PM <DIR> Links
    08/11/2014 08:17 PM <DIR> Music
    08/28/2014 06:46 PM <DIR> Pictures
    08/25/2013 11:56 PM <DIR> Potugadu (2013) ~ 320Kbps [Mazaa1.com]
    06/16/2014 12:42 AM <DIR> Run Raja Run (2014)
    08/11/2014 08:05 PM <DIR> Saved Games
    08/11/2014 08:06 PM <DIR> Searches
    04/04/2012 12:37 AM 677 systemlog
    08/23/2013 11:46 PM <DIR> Thoofan (2013)
    08/11/2014 08:05 PM <DIR> Videos
    3 File(s) 2,184 bytes
    23 Dir(s) 336,001,810,432 bytes free

    C:\Users\ANJIANU>

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: My first program

    You need to navigate to the directory where the source file, First.java, has been stored by your editor. Once you find the directory that it was stored in (can you do that?), use the 'cd' command to navigate to that directory, and try your command again.

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Location
    India
    Posts
    18
    My Mood
    Fine
    Thanks
    11
    Thanked 2 Times in 2 Posts

    Default Re: My first program

    wuth an example i can make you understand. let the path of your folder is e:/java/program, where program is folder in which your programs are stored.

    then in cmd prompt u'll use:

    c:/> e: //to enter in e drive (or anyother drive where folder is)
    e:/>cd java
    e:/java>cd program
    e:/java/program> javac first.java //to compile
    e:/java/program> java first

    hope ,this'll help you..!!
    BEST OF LUCK..!!

  6. The Following User Says Thank You to shilpy For This Useful Post:

    GregBrannon (September 24th, 2014)

  7. #6
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My first program

    Quote Originally Posted by shilpy View Post
    wuth an example i can make you understand. let the path of your folder is e:/java/program, where program is folder in which your programs are stored.

    then in cmd prompt u'll use:

    c:/> e: //to enter in e drive (or anyother drive where folder is)
    e:/>cd java
    e:/java>cd program
    e:/java/program> javac first.java //to compile
    e:/java/program> java first

    hope ,this'll help you..!!
    BEST OF LUCK..!!
    thanks for the reply i had done that you had suggested me i got

    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\ANJIANU>cd..

    C:\Users>cd..

    C:\>cd myprograms

    C:\MyPrograms>javac First.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.


    AND I HAD CHECKED WITH
    Microsoft Windows [Version 6.3.9600]
    (c) 2013 Microsoft Corporation. All rights reserved.

    C:\Users\ANJIANU>cd..

    C:\Users>cd..

    C:\>cd myprograms

    C:\MyPrograms>javac First.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    C:\MyPrograms>DIR
    Volume in drive C has no label.
    Volume Serial Number is F20A-0874

    Directory of C:\MyPrograms

    09/25/2014 05:45 AM <DIR> .
    09/25/2014 05:45 AM <DIR> ..
    09/23/2014 09:21 AM 124 First.java
    1 File(s) 124 bytes
    2 Dir(s) 337,767,636,992 bytes free

    C:\MyPrograms>

  8. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: My first program

    Looks like the OS can not find the javac.exe file. The folder that holds the javac.exe (usually bin) needs to be on the PATH environment variable. Do a Search for how to add a path to the PATH.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. switch program problem check my program and help how to fix
    By robel in forum Other Programming Languages
    Replies: 2
    Last Post: August 18th, 2014, 04:08 PM
  2. Replies: 8
    Last Post: August 17th, 2014, 12:31 PM
  3. Replies: 1
    Last Post: February 6th, 2014, 01:11 PM
  4. Program goes into infinite compilation. University project - Library Program.
    By clarky2006 in forum What's Wrong With My Code?
    Replies: 35
    Last Post: November 10th, 2012, 03:56 PM
  5. Replies: 1
    Last Post: July 8th, 2012, 10:23 AM