Results 1 to 3 of 3
  1. #1
    ShedoSurashu is offline Member
    Join Date
    Nov 2013
    Posts
    13
    Rep Power
    0

    Default How to import a class that isn't inside a package?

    I have a class called Foo1 that is inside the package mypackage. Then, I need to import another class Bar but it is in the src directory without any packages containing it. How do I import it to Foo1?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default Re: How to import a class that isn't inside a package?

    What have you tried? Show what the directory structure and classpath are for when you try to compile the class.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    ShedoSurashu is offline Member
    Join Date
    Nov 2013
    Posts
    13
    Rep Power
    0

    Default Re: How to import a class that isn't inside a package?

    Quote Originally Posted by Norm View Post
    What have you tried? Show what the directory structure and classpath are for when you try to compile the class.
    Actually scratch that question. I figured out how to do it the other way around and made me realize that my approach was wrong to begin with. :P

Similar Threads

  1. Replies: 0
    Last Post: 06-30-2013, 07:44 PM
  2. import package
    By gulhk in forum New To Java
    Replies: 4
    Last Post: 12-27-2012, 05:24 PM
  3. Replies: 10
    Last Post: 09-06-2011, 06:22 AM
  4. run package inside anthor package
    By AhmedAdel in forum AWT / Swing
    Replies: 4
    Last Post: 04-20-2010, 11:52 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
  •