Results 1 to 4 of 4
  1. #1
    Bharat is offline Member
    Join Date
    Aug 2008
    Posts
    5
    Rep Power
    0

    Default importing packages at the same level

    Hi,
    I have two packages A at B in the same level. How do i import the classes from one packages to other.......

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,422
    Rep Power
    20

    Default

    Just another cross poster. More than adequately answered here:
    New To Java - importing packages at the same level

    db

  3. #3
    rdtindsm is offline Member
    Join Date
    Feb 2009
    Posts
    92
    Rep Power
    0

    Default Same problem, maybe

    Same question, prompted by an attempt to find the asnwer. Let me be more specific on my assumption and attempts to solve it.

    When the previous post says "same level", I read that I am in foobar/foo/foo.java and he has a class in foobar/bar/bar.java.

    ComSci 101, but thought the obvious answer was ../bar/bar.java, or that a fully realized path would work. Doesn't seem to. My question may be different than his, but it exists anyway.

    I have a java file in eclipse on my hard drive at
    k:/workspace2/props/src/rdt_props/Props. Its a Sun tutorial exercise.

    I have a project that I compiled on another question on greatest common denominator. It is at

    I have a java file in eclipse on my hard drive at
    k:/workspace2/GCD/src/rdt_GCD/GCD
    with a line in the Props source -
    import k:/workspace2/GCD/src/rdt_GCD/GCD

    Eclipse just complains about either a relative path, or a full path. Eclipse has some environment stuff to set that may solve the problem, but I should also be able to import the other package when I compile from the command line.

    Is the import syntax incorrect? Do I need to set a switch in javac. The onlything I saw with java -help is that it might be a classpath problem, but that didn't help;

    Edit: I was writing this when the above answer was posted. Read the post on sun. Still having problems, They said exactly what I thought. I'm assuming that we need to import the binary class file, not the source code. Eclipse puts them in different paths src/pckg/foo.java v. bin/pckg/foo.class
    Last edited by rdtindsm; 03-29-2009 at 11:29 PM. Reason: new data

  4. #4
    Bharat is offline Member
    Join Date
    Aug 2008
    Posts
    5
    Rep Power
    0

    Default

    I have cross posted in other forums hoping to get the answers quickly. Can you please help me out. I am doing my project and when i tried to organize my files using package, i encountered this problem. Kindly help

Similar Threads

  1. importing external packages
    By bubbles in forum New To Java
    Replies: 3
    Last Post: 01-21-2009, 12:42 AM
  2. Row level locking........
    By jithan in forum New To Java
    Replies: 0
    Last Post: 09-02-2008, 08:09 AM
  3. row level locking
    By jithan in forum New To Java
    Replies: 1
    Last Post: 08-28-2008, 07:42 PM
  4. Java Debug Level
    By keshari in forum New To Java
    Replies: 1
    Last Post: 05-26-2008, 09:23 AM
  5. Replies: 3
    Last Post: 02-12-2008, 12:03 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
  •