Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Package Importing Help

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Package Importing Help

    Hi friends i need a lil help.

    How can i import a package from a back folder.

    Example:

    I have a folder named " project "
    in " project " folder i have two package folders name named " a " and " b "

    now i want to import package of " b " folder into the package of " a " folder ..is there any way?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,187
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: Package Importing Help

    The classpath should point to the folder that contains the folder at the start of the package name.
    If the package is: mypkg
    and the full path is: C:/Testing/mypkg/myClass.class
    then the classpath should be: C:/Testing
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Package Importing Help

    i don,t understand ... um new in java... can you explain it clearly

    Repeating my qus again :

    Dear yes we can import package with import a.*;

    import a.*; <Thats mean we are importing all class containing in a folder

    and we need a java file outer of the " a " folder to import package " a "

    but my question is that if we have to different package named " a " and " b "

    that's mean " a " and " b " is two different folder

    if we have a java file " test.java " outside of " a " and " b " folder then we can import packages by import a.; and import b.;

    but i want to call package " a " from package "b" so can

    So can i write import a.*; in the java file " b.java " contain inside " b " folder package?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,187
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: Package Importing Help

    If the package is "a" then the classpath should point to the folder holding the "a" folder
    and the same for the "b" package.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 4
    Last Post: November 8th, 2012, 06:55 AM
  2. Replies: 1
    Last Post: August 5th, 2012, 05:01 AM
  3. Simple package problem, package does not exist error
    By Farmer in forum Object Oriented Programming
    Replies: 3
    Last Post: August 23rd, 2011, 11:18 AM
  4. Importing gif/pictures
    By javanerd in forum Java Theory & Questions
    Replies: 2
    Last Post: October 31st, 2010, 11:58 PM
  5. importing packages..
    By chronoz13 in forum Java IDEs
    Replies: 4
    Last Post: November 23rd, 2009, 04:49 PM