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 5 of 5

Thread: Accessing Package from a Different Directory

  1. #1
    Member
    Join Date
    Sep 2010
    Posts
    32
    My Mood
    Confused
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Question Accessing Package from a Different Directory

    I have created package in D drive. It exists in D:\ramesh\ directory

    package ramesh;
    public class sourcee
    {
    public void display()
    {
    System.out.println("Source Package");
    }
    }


    I have my another source file in E Drive.It exists in E:\Java


    import ramesh.sourcee; // How to change import statement?
    class deestination
    {
    public static void main(String args[])
    {
    sourcee ss=new sourcee();
    ss.display();
    }
    }



    How do I make import statement to refer to D:\ramesh since my program is in E;\ drive.. ?

    Please help....


  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    491
    Thanks
    8
    Thanked 47 Times in 45 Posts

    Default Re: Accessing Package from a Different Directory


  3. #3
    Member
    Join Date
    Sep 2010
    Posts
    32
    My Mood
    Confused
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Accessing Package from a Different Directory

    @Darryl: I'm new to both the forum . Is both are same? I couldn't get answer for my question yet !

  4. #4
    Junior Member
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Accessing Package from a Different Directory

    Hi Ramesh,

    You need to add the following

    D:\Ramesh

    to already existing classpath variable in Environment Variables.

    for ex:

    C:\program files\java\lib;D:\Ramesh;

  5. #5
    Member
    Join Date
    Sep 2010
    Posts
    32
    My Mood
    Confused
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Accessing Package from a Different Directory

    Thanks for reply comment ! Is there any way to use the package without setting the environment variable ?

Similar Threads

  1. How to instal JDBC driver package in eclipse
    By sathish in forum JDBC & Databases
    Replies: 2
    Last Post: September 2nd, 2010, 10:09 AM
  2. [SOLVED] Finding acm package
    By javapenguin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 12th, 2010, 11:50 AM
  3. Accessing Properties File
    By java_mein in forum Java Servlet
    Replies: 5
    Last Post: May 14th, 2010, 02:44 AM
  4. Vectors - accessing an unknown amount of objects
    By fox in forum Loops & Control Statements
    Replies: 1
    Last Post: May 7th, 2010, 03:54 PM
  5. accessing elements in a 2d ArrayList
    By Flamespewer in forum Collections and Generics
    Replies: 2
    Last Post: March 8th, 2010, 05:11 PM