Results 1 to 11 of 11
  1. #1
    Abder-Rahman is offline Member
    Join Date
    Oct 2008
    Posts
    32
    Rep Power
    0

    Default Importing a zipped package to Eclipse

    I have a package zipped using Winrar, and want to import it using Eclipse IDE. I did that by using the "Import" function when you right-click on your project's name. But, when I create a new class, and type, say:

    import element.*;

    I get an error.

    What should I do?

    Thanks.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,558
    Rep Power
    25

    Default

    What is the error?

  3. #3
    Abder-Rahman is offline Member
    Join Date
    Oct 2008
    Posts
    32
    Rep Power
    0

    Default

    The error says:

    The import element cannot be resolved.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,558
    Rep Power
    25

    Default

    When posting error messages, please post the full text of the error message. Don't edit it.

    Where is element defined?

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  6. #6
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Merely importing the file to your Eclipse project only makes the file a part of your project, it doesn't actually add it to your build path. You have to do that, too

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by georgemc View Post
    Merely importing the file to your Eclipse project only makes the file a part of your project, it doesn't actually add it to your build path. You have to do that, too
    Is that Eclipse don't automatically do that? I'm not an Eclipse user, that's why I ask that question, hope you are.

  8. #8
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Is that Eclipse don't automatically do that? I'm not an Eclipse user, that's why I ask that question, hope you are.
    It doesn't automatically do it, no. It can't, really, because you could be importing a zip or jar file for any number of reasons, and not necessarily to be on your Eclipse build path. Or, if you've got multiple projects, one of which is a "lib" project (not uncommon) then the jar isn't meant to be used on that project's build path, but by other projects instead. So you have to import it, and then tell Eclipse it's part of your build path

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  10. #10
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by Eranga View Post
    Is that your package located in the same location of the project folder is located?

    suppose you want to use the package from different projects. do you need to make a copy of the package in each project folder?!

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. org.eclipse.core package
    By Eranga in forum Advanced Java
    Replies: 2
    Last Post: 07-07-2008, 05:26 AM
  2. How to import a package in Eclipse?
    By naipulb in forum New To Java
    Replies: 2
    Last Post: 06-09-2008, 11:04 AM
  3. Combine package of(jdk,eclipse and tomcat)
    By joseph in forum Eclipse
    Replies: 0
    Last Post: 04-07-2008, 01:18 PM
  4. Importing / compiling and running with .jar package
    By splinter64uk in forum New To Java
    Replies: 1
    Last Post: 12-05-2007, 02:47 AM
  5. Importing package
    By bugger in forum New To Java
    Replies: 5
    Last Post: 11-26-2007, 12:29 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
  •