jars v. classes

Discussion in 'Java' started by soup_or_power@yahoo.com, Nov 10, 2005.

  1. Guest

    Hi All
    I have a development environment where several jars are located say in
    a directory /home/user/jars.
    The java source is located say at /home/user/src. As I compile the
    sources with -d option, they are placed under /home/user/jars. The
    classpath contains all the jars. I am finding that when I run the code,
    it is picking up stuff from jars ignoring the class files. IS there a
    simple solution to fix this problem. IOW, how can I tell javac to first
    look at class files and then jars. I don't enough about this
    development environment dependencies to create an ant script. Your help
    is appreciated.

    /home/user/src ------------java files (e.g. myjara.java)
    /home/user/jars -----------jars and class files

    cd /home/user/src
    javac -d ../jars myjava.java

    Thanks for your help.
     
    , Nov 10, 2005
    #1
    1. Advertising

  2. Roedy Green Guest

    On 10 Nov 2005 05:58:06 -0800, wrote, quoted
    or indirectly quoted someone who said :

    >I am finding that when I run the code,
    >it is picking up stuff from jars ignoring the class files.


    That is the way it is supposed to work. The solution is to put all
    your classes in jars and to use a jar class-path.

    See http://mindprod.com/jgloss/jarexe.html
    http://mindprod.com/jgloss/jar.html
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
     
    Roedy Green, Nov 10, 2005
    #2
    1. Advertising

  3. wrote:

    > ...The
    > classpath contains all the jars.


    Sun has been recommending against 'dumping every jar on
    the classpath' for some time. Because..

    >...I am finding that when I run the code,
    > it is picking up stuff from jars ignoring the class files.


    ...mostly of that, and other associated hassles.

    Add Jar's and/or classes to the run of each java project
    selectively, and the problem is solved.
     
    Andrew Thompson, Nov 10, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Udo Corban
    Replies:
    0
    Views:
    3,936
    Udo Corban
    Jan 23, 2004
  2. Ike
    Replies:
    6
    Views:
    1,103
    Andrew Thompson
    Sep 24, 2004
  3. Replies:
    5
    Views:
    9,119
  4. JavaEnquirer
    Replies:
    2
    Views:
    550
    JavaEnquirer
    Feb 22, 2006
  5. Ulf Meinhardt
    Replies:
    2
    Views:
    1,436
Loading...

Share This Page