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: Calling jar from different directory

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Calling jar from different directory

    I wanted to know if it was at all possible to have a jar (coded by me) in some directory use another jar (also coded by me) that is in a different directory.

    Example:

    Main jar path = C:/My Program/core

    Secondary jar path = C:/My Program/lib

    It is not a jar with pictures. Kind of like the secondary jar is an API for my program.

    Example:

    import net.myprogram.api.MyApiClass;

    public class MyProgram extends MyApiClass{
    ......
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Calling jar from different directory

    The called jar needs to be on the classpath so the java program can the class files and resources that it contains.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Calling jar from different directory

    I'm still new to Java, and I'm not sure how to do that.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Calling jar from different directory

    See the doc for the java program: java - the Java application launcher
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. run jar file inside a jar file?
    By ufrubnuckle in forum Java Theory & Questions
    Replies: 1
    Last Post: February 21st, 2013, 06:58 AM
  2. How to copy files from one directory to another directory
    By kewlkeny in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: January 25th, 2012, 07:36 AM
  3. Getting audio stream to play from jar file instead of system directory?
    By nivangerow in forum What's Wrong With My Code?
    Replies: 26
    Last Post: October 5th, 2011, 09:51 AM
  4. [SOLVED] jar file Built(clean and build) perfectly, but not running as jar
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 18
    Last Post: July 11th, 2011, 11:41 AM
  5. Java.jar and Mysql.jar
    By kurt-hardy in forum Java Theory & Questions
    Replies: 1
    Last Post: January 27th, 2011, 09:48 AM