CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Location
    Kaysville, UT
    Posts
    228

    Class "must be defined in a file called" error

    When compiling I get the following error:

    /comm/client/MainClass.java:25: Public class comm.client.MainClass must be defined in a file called "MainClass.java".

    The funny thing is that MainClass *is* defined in a file called MainClass.java, and all text has the correct case. I haven't any idea what else could be causing this error. Does anyone have any suggestions?


    "There's nothing more dangerous than a resourceful idiot." ---Dilbert
    BWAHAHAHAHAHAHA! ---Murray

  2. #2
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: Class "must be defined in a file called" error

    Hi
    Try to right click your .java file and choose
    properties, and see what the file is called.
    Somtimes it can get saved as MainClass.java.txt
    This has happened to me, so now when saving a
    file i always put quote marks around it
    "MainClass.java"
    Hope this helps.
    Phill


  3. #3
    Join Date
    Sep 2000
    Location
    Hampshire, UK
    Posts
    2

    Re: Class "must be defined in a file called" error

    Does your MainClass class have the line

    package comm.client;

    ?


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured