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: Where to place my own library?

  1. #1
    Member hexwind's Avatar
    Join Date
    May 2011
    Location
    Tunisia
    Posts
    48
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Where to place my own library?

    Hi
    I'm using Eclipse (on Ubuntu 11.04) and I created a new project that i called outofbox, in this project i created a new package that i called arrays in which i created a class called Arrays that has methods that perform certain operations on Arrays. I want to call this class from other projects, i must, i want to simply type sth like "import outofbox.array.Arrays;" in any class of a project im working on, where should I put this package?
    I hope i made my point clearly
    thanks for your help guys in advance
    My website : MediDev


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Where to place my own library?

    Export your library as a jar. Then add that jar to the classpath of the project you wish to use it in.
    http://download.oracle.com/javase/tu...eployment/jar/
    http://download.oracle.com/javase/tu...ent/paths.html

  3. #3
    Member hexwind's Avatar
    Join Date
    May 2011
    Location
    Tunisia
    Posts
    48
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Where to place my own library?

    alright, so i edited my ~/.bashrc file and i added this :

     PATH=/usr/lib/jvm/java-6-sun-1.6.0.26/bin:/usr/bin
    export PATH
    CLASSPATH=/usr/lib/jvm/java-6-sun-1.6.0.26/bin:/usr/bin:/home/mohamed/workspace/arrays.jar
    export CLASSPATH
    how can I import it now?
    My website : MediDev

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Where to place my own library?

    In eclipse, give your arrays.jar reference in the "reference libraries" and in the code you can import the classes in the jar file

Similar Threads

  1. Powerpoint Library
    By aussiemcgr in forum Java Theory & Questions
    Replies: 0
    Last Post: July 22nd, 2010, 08:26 AM
  2. How to place icon on a picture base on (x,y) axis
    By FaintSmile in forum Java Theory & Questions
    Replies: 1
    Last Post: July 13th, 2010, 07:27 AM
  3. library
    By b109 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 3rd, 2010, 05:32 AM
  4. great place to start
    By flotsam in forum The Cafe
    Replies: 2
    Last Post: April 22nd, 2010, 10:52 AM
  5. Best way to learn java for beginners
    By JavaPF in forum The Cafe
    Replies: 0
    Last Post: May 8th, 2008, 04:37 AM