class outside of its source file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: class outside of its source file

  1. #1
    haagen Guest

    class outside of its source file


    Hi,

    I use a class called OKFrame in a file that does not contained it
    and I have this error message:


    src/jade/grassplot/OxGrid.java:55: class jade.grassplot.OKFrame
    is defined in MapSetPick.java. Because it is used outside of its
    source file, it should be defined in a file called "OKFrame.java".
    OKFrame ok = new OKFrame();
    ^


    I tried to import the file where my class is in the file where
    I want to use it but it doesn't work, and I don't know why I
    should defined my class alone in a file.

    Thanks a lot


  2. #2
    Paul Clapham Guest

    Re: class outside of its source file

    From what I can see, you are not trying to USE the class OKFrame in this
    file. You are trying to DEFINE it there. Why should you define your class
    alone in its own file? Because that's the rule in Java. Create a file
    called OKFrame.java, as the message says, and put the code for the class
    OKFrame in it. The file MapSetPick.java should contain only the class
    MapSetPick; it can create objects of class OKFrame if you like.

    haagen <haagendemerak@hotmail.com> wrote in message
    news:399d3ebe$1@news.devx.com...
    >
    > Hi,
    >
    > I use a class called OKFrame in a file that does not contained it
    > and I have this error message:
    >
    >
    > src/jade/grassplot/OxGrid.java:55: class jade.grassplot.OKFrame
    > is defined in MapSetPick.java. Because it is used outside of its
    > source file, it should be defined in a file called "OKFrame.java".
    > OKFrame ok = new OKFrame();
    > ^
    >
    >
    > I tried to import the file where my class is in the file where
    > I want to use it but it doesn't work, and I don't know why I
    > should defined my class alone in a file.
    >
    > Thanks a lot
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center