[Java] Error when running my program

Results 1 to 9 of 9
  1. #1
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    [Java] Error when running my program

    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    Last edited by King Grub; 23-01-11 at 10:02 AM.


  2. #2
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: Error when running my java program

    Your filename must match your class if the class is declared as public.

    Looks to me like your file is sanumber.java, but your class is Main. Change either the class or filename to match.

  3. #3
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    Re: Error when running my java program

    The main file in netbeans are named ''Main''.

  4. #4
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: Error when running my java program

    I don't use netbeans myself, but by main file do you mean the project? You would need to ensure the class file is named appropriately.

  5. #5
    offonline King Grub is offline
    Grand MasterRank
    Aug 2009 Join Date
    Spring fieldLocation
    3,303Posts

    Re: Error when running my java program

    Quote Originally Posted by Smitty View Post
    I don't use netbeans myself, but by main file do you mean the project? You would need to ensure the class file is named appropriately.
    Ummh i'm a bit untrained with these stuff, i pm'ed you with my msn.
    :)

  6. #6
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: Error when running my java program

    I am watching this thread...no need for MSN as I don't like giving mine out.

    Give me 5 minutes to download netbeans and I will see what I can do.

  7. #7
    Ginger by design. jMerliN is offline
    Grand MasterRank
    Feb 2007 Join Date
    2,500Posts

    Re: Error when running my java program

    class sanumber not found, what is the difficulty again?

    read your errors ppl!

  8. #8
    Elite Member Smitty is offline
    Member +Rank
    Nov 2004 Join Date
    Kingston, ONLocation
    150Posts

    Re: Error when running my java program

    Quote Originally Posted by jMerliN View Post
    class sanumber not found, what is the difficulty again?

    read your errors ppl!
    His class is declared properly as far as I can tell with my conversation with him thus far. It seems he is building it into a jar and I assume that is causing the issue.

    I tried to talk him through building it via the command line but his English isn't that good, so I am attempting to explain how to do it via Eclipse now.

  9. #9
    Newbie ExploitR is offline
    MemberRank
    Aug 2009 Join Date
    23Posts

    Re: Error when running my java program

    May be a long shot but i think the java compiler / interpreter looks for the word Main, so change your "public class Main" to something else and try again. I've only done a little java, and don't get much chance to try any java regulary. But anyway, cant hurt to try :D



Advertisement