After Jar creation, when I call from another project gives me java.lang.NoClassDefFoundError

Discussion in 'Java' started by asfonseca, Jun 4, 2004.

  1. asfonseca

    asfonseca Guest

    I'm using WebSphere.
    I've create a java project, with one class, that has several methods.
    Export it has a jar file. Then in another project add it in libraries has
    an external jar file.
    When I call methods from that class, it recognizes every method, and
    compiles ok. When I try to run it it gives me
    "java.lang.NoClassDefFoundError".
    Can I create a jar file from a java project?
    I'm doing something wrong, it's annoying me, because this jar file is
    what's missing me to conclude this project.
    Any ideas?
    Thanxs
    Antonio Fonseca
     
    asfonseca, Jun 4, 2004
    #1
    1. Advertising

  2. asfonseca

    Davis Guest

    "asfonseca" <> wrote in message news:<>...
    > I'm using WebSphere.
    > I've create a java project, with one class, that has several methods.
    > Export it has a jar file. Then in another project add it in libraries has
    > an external jar file.
    > When I call methods from that class, it recognizes every method, and
    > compiles ok. When I try to run it it gives me
    > "java.lang.NoClassDefFoundError".
    > Can I create a jar file from a java project?
    > I'm doing something wrong, it's annoying me, because this jar file is
    > what's missing me to conclude this project.
    > Any ideas?
    > Thanxs
    > Antonio Fonseca


    The java.lang.NoClassDefFoundError is the most irritating error you
    can get. I have put together a White Paper on the issues using
    packages in jar files. You can view it at
    http://www.sqlmagic.com/resources/jarfiles.htm. Hope it helps.
     
    Davis, Jun 4, 2004
    #2
    1. Advertising

  3. asfonseca

    Roedy Green Guest

    Roedy Green, Jun 4, 2004
    #3
  4. asfonseca

    Micha Guest

    "asfonseca" <> wrote in message
    news:...
    > I'm using WebSphere.
    > I've create a java project, with one class, that has several methods.
    > Export it has a jar file. Then in another project add it in libraries has
    > an external jar file.
    > When I call methods from that class, it recognizes every method, and
    > compiles ok. When I try to run it it gives me
    > "java.lang.NoClassDefFoundError".
    > Can I create a jar file from a java project?
    > I'm doing something wrong, it's annoying me, because this jar file is
    > what's missing me to conclude this project.
    > Any ideas?
    > Thanxs
    > Antonio Fonseca
    >
    >

    Sounds like you only have set the Java Build Path of your second program. In
    WebSphere you also have to set it on the classpath in the Launch
    Configuration (if its a java application), on the classpath of the server or
    as the Utilies Jar in the Ear.
     
    Micha, Jun 4, 2004
    #4
  5. asfonseca

    asfonseca Guest

    Re: After Jar creation, when I call from another project gives me ja

    Thanks all, for your reply.
    After all it was much more simple, I've drag and drop my jar file, in the
    “web content”\”WEB-INF\lib” folder. I thought that by adding the jar as an
    external JAR, would do just find, I was wrong.
    I don't know if this is the right way, but, i've run several tests, and
    everything, seems to work great.
    I'll stick with this.
    Regards,
    AntonioFonseca
     
    asfonseca, Jun 8, 2004
    #5
    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.

Share This Page