Results 1 to 17 of 17
Like Tree1Likes
  • 1 Post By Fubarable

Thread: Need urgent help with my first project Hello world app

  1. #1
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Need urgent help with my first project Hello world app

    Hello
    i am totally noob at this i am trying to compile my first project but it has give me some error

    Last edited by saif; 07-21-2012 at 06:50 PM.

  2. #2
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Need urgent help with my first project Hello world app

    The compiler has a problem with this line:
    Java Code:
    System.out.println(Hello world!");
    Does something about that line look wrong to you?
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  3. #3
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    ya u r rigth it should be like this

    Java Code:
    System.out.println("Hello world!");

  4. #4
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    it was giving me another error


  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Need urgent help with my first project Hello world app

    Please show your code and error messages in the forum as text, not as images, and please use [code] [/code] tags when doing so. The forum faq or my link below will explain how to do this. You can get the text from your cmd window easily by copying and pasting it.

    As for your problem, the error message is telling you which identifier is not recognized, so you need to check, did you spell it correctly? If so, did you cApTaLiZe it correctly? Both matter.

    Finally, please don't label your question "urgent" or anything similar as it suggests that you feel your question is more important than any other question here, and that's not being fair to the other folks who need help here.

    Thanks for your cooperation in this.
    saif likes this.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default Re: Need urgent help with my first project Hello world app

    Do you have stocks in optician equipment or something?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    Quote Originally Posted by Fubarable View Post
    Please show your code and error messages in the forum as text, not as images, and please use [code] [/code] tags when doing so. The forum faq or my link below will explain how to do this. You can get the text from your cmd window easily by copying and pasting it.

    As for your problem, the error message is telling you which identifier is not recognized, so you need to check, did you spell it correctly? If so, did you cApTaLiZe it correctly? Both matter.

    Finally, please don't label your question "urgent" or anything similar as it suggests that you feel your question is more important than any other question here, and that's not being fair to the other folks who need help here.

    Thanks for your cooperation in this.
    sorry i will be more careful next time

  8. #8
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    umm i dont see any problem in it may be u can point me out

    Java Code:
    /* This is my First program*/
    class myFirst {
    
    public static void main (string [] args) {
    
    System.out.println("Hello world!");
    
    }
    
    
    
    }
    Last edited by saif; 07-22-2012 at 05:59 AM.

  9. #9
    Join Date
    Sep 2011
    Location
    Mumbai, India
    Posts
    35
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    Just have a look at the spelling of a word in the parenthesis (brackets) of main.
    You have written string and its actually a class in Java so it should be String. (i.e. S is capital)
    Java is case-sensitive.

  10. #10
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Need urgent help with my first project Hello world app

    Yep. The error has a little hat symbol "^" under the "string" token notifying you that it is the offending bit. That should clue you into checking how it's spelled and capitalized.

  11. #11
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    it comes to me with another error

    Java Code:
    C:\Documents and Settings\SK\My Documents>java MyFirst
    Error: Could not find or load main class MyFirst

  12. #12
    Join Date
    Sep 2011
    Location
    Mumbai, India
    Posts
    35
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    I am not really sure because it has been months that i haven't opened my Java book.
    But then too i would like to pin-point some things

    1) Its always bad to save files in the place where you are saving, its good to make a directory by your name in say D: drive and save all your .java (dot java) and .class (dot class) in it. Definitely Java has no problem where you are saving your files.

    2) So are you sure that your .class (dot class) file which you got after successful compilation of your Java file, is in your same directory from which you are compiling through.

    3) Anyways just try this and see
    java -cp . myFirst

    if it works.

    ( for this program don't change anything and start from step 2 of this post.)

  13. #13
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    yes the .class is there

    and i tried the code u give it has given me error

    Java Code:
    C:\Documents and Settings\SK\My Documents>java -cp . myFirst
    Exception in thread "main" java.lang.NoClassDefFoundError: myFirst (wrong name:
    MyFirst)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$100(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

  14. #14
    Join Date
    Sep 2011
    Location
    Mumbai, India
    Posts
    35
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    I am unable to find any mistakes sorry!!!!!!!

    But if you want then you can take a fresh start.

    1) Just open a text editor like Notepad and write your program in it.

    2) Save the file as myFirst.java in the place where you want or save it in D:\saif directory. (i will consider that you are saving your file here i.e. in D:\saif directory)

    3) Open command prompt it will initailly point at c:\Documents and setting\................. etc, just type d: and press enter

    4) Now you would see D;\ on command prompt. Now type cd saif and press enter

    5) Now command prompt will have D:\saif>

    6) Now compile your program
    javac myFirst.java

    7) Now execute it
    java -cp . myFirst

  15. #15
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    ok i will try

  16. #16
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    same error no luck

  17. #17
    saif is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Re: Need urgent help with my first project Hello world app

    solved get it working just a path problem

Similar Threads

  1. Java world generator-real world with people and stuff
    By conker5295 in forum Jobs Offered
    Replies: 2
    Last Post: 02-23-2012, 01:22 PM
  2. [URGENT]SHA Encryption System...need urgent helps
    By java_idiot in forum New To Java
    Replies: 6
    Last Post: 05-02-2010, 10:04 AM
  3. Hello, World!
    By Steve11235 in forum Introductions
    Replies: 0
    Last Post: 12-22-2008, 05:00 PM
  4. Hello World!:)
    By parme in forum Introductions
    Replies: 0
    Last Post: 12-05-2008, 08:04 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
  •