Errors With Jar file...

Discussion in 'Java' started by balgach@gmail.com, May 10, 2005.

  1. Guest

    Hello all,

    I am trying to jar up my classes for easy access, the problem is as
    follows...

    my application depends on teh postgresql jdbc driver (pg73jdbc.jar)
    now when i compile and run as classes with this jar file in the
    CLASSPATH, everythign works fine all well and good. When i jar the
    classes up, i get a ClassNotFound Exception when looking for the JDBC
    drivers. (even though it is in my class path)

    ive even tried:

    java -jar myapp.jar pg73jdbc.jar

    and get the same errors. is there something i am missing when creating
    the jar file? can i somehow include the pg73jdbc.jar file with my jar
    file, to just have one large jar file? Thanks.


    Cheers,
    Adam.
     
    , May 10, 2005
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hello all,
    >
    > I am trying to jar up my classes for easy access, the problem is as
    > follows...
    >
    > my application depends on teh postgresql jdbc driver (pg73jdbc.jar)
    > now when i compile and run as classes with this jar file in the
    > CLASSPATH, everythign works fine all well and good. When i jar the
    > classes up, i get a ClassNotFound Exception when looking for the JDBC
    > drivers. (even though it is in my class path)
    >
    > ive even tried:
    >
    > java -jar myapp.jar pg73jdbc.jar
    >
    > and get the same errors. is there something i am missing when creating
    > the jar file? can i somehow include the pg73jdbc.jar file with my jar
    > file, to just have one large jar file? Thanks.
    >
    >
    > Cheers,
    > Adam.


    Hi Adam!

    You have to specify an additional Class-Path in your main jar-file's
    manifest-file. It is described in
    http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#JAR Manifest (look
    for "Class-Path" there).

    You can *not* use the "-classpath" option or the "CLASSPATH" environment
    variable, when
    starting it with "java -jar ...", simply because these classpath settings
    are not evaluated then
    This peculiar feature is documented in
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html#-jar (see the
    last sentence there)

    There are also some threads in this newsgroups concerning that topic.
    You can find them with
    http://groups.google.de/groups?as_q=jar Class-Path manifest

    HTH
    --
    "TFritsch$t-online:de".replace(':','.').replace('$','@')
     
    Thomas Fritsch, May 11, 2005
    #2
    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. lucy
    Replies:
    6
    Views:
    30,950
    steve
    Sep 7, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    631
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,790
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,868
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    700
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page