Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By JosAH

Thread: Eclipse - using a method from package a in package b

  1. #1
    sayswho is offline Member
    Join Date
    Jul 2013
    Location
    Dublin, CA
    Posts
    12
    Rep Power
    0

    Default Eclipse - using a method from package a in package b

    Hello again


    I am using Eclipse and I have 2 projects there. Project 1 has a package named "commonFiles" with a class "Common"; project2 has a package named "practice" with a class "SendKeys".

    I want to use a method from "commonFiles" in "SendKeys".

    I added

    import commonFiles.*;

    in my "SendKeys" class but then I get an error message saying "the import cannot be resolved".

    What might be causing it?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,373
    Blog Entries
    7
    Rep Power
    25

    Default Re: Eclipse - using a method from package a in package b

    Different projects have nothing to do with each other; i.e. the classes defined in one project are unknown to the classes in another project; unless you link them: right click on your project and go to Properties>Project references. Select the other project(s) your project wants to refer to and voila.

    kind regards,

    Jos
    sayswho likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,005
    Rep Power
    23

    Default Re: Eclipse - using a method from package a in package b

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    sayswho is offline Member
    Join Date
    Jul 2013
    Location
    Dublin, CA
    Posts
    12
    Rep Power
    0

    Default Re: Eclipse - using a method from package a in package b

    Thank you

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2013, 07:07 PM
  2. Replies: 3
    Last Post: 03-27-2012, 09:27 AM
  3. run package inside anthor package
    By AhmedAdel in forum AWT / Swing
    Replies: 4
    Last Post: 04-20-2010, 11:52 AM
  4. Replies: 7
    Last Post: 11-09-2009, 08:51 AM
  5. How to import a package in Eclipse?
    By naipulb in forum New To Java
    Replies: 2
    Last Post: 06-09-2008, 11:04 AM

Posting Permissions

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