NoClassDefFoundError

Discussion in 'Java' started by emf, Jan 1, 2013.

  1. emf

    emf Guest

    After a long time, I tried to create an applet. In eclipse it runs
    perfect as an applet, but in the webpage in the browser it gives a
    NoClassDefFoundError.

    I even tried my very first program, HelloWorldApplet, but I got again
    the same problem.

    What kind of problem is this? Is it a compilation issue? Or is it an
    eclipse problem? At this stage I would be happy to have the
    HelloWorldApplet run: I feel if I this runs, my other program will run too.

    emf

    --
    It ain't THAT, babe! - A radical reinterpretation
    https://files.nyu.edu/emf202/public/bd/itaintmebabe.html
    emf, Jan 1, 2013
    #1
    1. Advertising

  2. On 12/31/2012 9:24 PM, emf wrote:
    > After a long time, I tried to create an applet. In eclipse it runs
    > perfect as an applet, but in the webpage in the browser it gives a
    > NoClassDefFoundError.
    >
    > I even tried my very first program, HelloWorldApplet, but I got again
    > the same problem.
    >
    > What kind of problem is this? Is it a compilation issue? Or is it an
    > eclipse problem? At this stage I would be happy to have the
    > HelloWorldApplet run: I feel if I this runs, my other program will run too.


    Impossible to say without more info.

    It could be that the class/jar file is not correctly placed
    or is not correctly served by the web server.

    Arne
    Arne Vajhøj, Jan 1, 2013
    #2
    1. Advertising

  3. emf

    Lew Guest

    Arne Vajhøj wrote:
    > emf wrote:
    >> After a long time, I tried to create an applet. In eclipse [sic] it runs
    >> perfect as an applet, but in the webpage in the browser it gives a
    >> NoClassDefFoundError.


    Hmm. Could there be a dependent JAR missing in the browser context?

    >> I even tried my very first program, HelloWorldApplet, but I got again


    Example, please?
    http://sscce.org/

    >> the same problem.


    Which would be ...?

    Yes, yes, you said 'NoClassDefFoundError'. What was the *exact* message?

    What is the code?

    >> What kind of problem is this?


    http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html

    You did read this before, yes?

    It explains exactly what kind of problem this is.

    RTFM is sooo useful.

    >> Is it a compilation issue?


    Really? Come on.

    >> Or is it an eclipse [sic] problem?


    Given that it doesn't happen in Eclipse, according to your report, I'd haveto
    guess no.

    >> At this stage I would be happy to have the HelloWorldApplet run: I feel if I this runs, my other program will run too.


    "Feel"? Logic should rule.

    > Impossible to say without more info.


    Quite.

    Although it's certainly possible to say this isn't a compilation error,


    given that it happened at runtime


    and not during compilation.


    > It could be that the class/jar file is not correctly placed
    > or is not correctly served by the web server.


    Or not referenced properly in the various tags and applet JAR.

    How are you packaging the applet?

    How are you specifying its classpath?

    --
    Lew
    Lew, Jan 1, 2013
    #3
  4. emf

    Lew Guest

    lipska the kat wrote:
    > You really are an objectionable little oike aren't you.


    Yes, I'm afraid I am.

    > Is there really any reason to be so rude ?


    Well, now, let's wonder at who's being rude. This person jumps
    in to a discussion group to ask a question, ostensibly because
    they need help, but they ask a question that's answered by the
    most elementary initial step in analysis. This means they haven't
    even takent the most elementary initial step in analysis.

    That's looking up the error and reading its description, in case
    you don't know.

    Now failing to quote the error and provide code, that's fine, it's
    a rookie mistake and no one holds it against the newbie. You point
    them to http://sscce.org/ and request the missing data and everyone
    progresses.

    But it's rude to come to a bunch of folks, especially if you think
    they are experts and presumably therefore worthy of respect, and just
    expect them to drop everything and spoon-feed you answers you aren't
    even going to understand anyway. It's beyond rude, it's presumptuous.

    People here are inclined to help, voluntarily, for a variety of reasons.

    Yes, even this objectionable little oike is helping. Everything I've said
    is true and useful. Including the attitude. Go help yourself before you
    waste people's time with trivial questions you should have already
    answered yourself.

    But perhaps you yourself are not of such advanced skill to find such
    behavioral failure an imposition.

    --
    Lew
    Lew, Jan 1, 2013
    #4
  5. emf

    Lew Guest

    emf wrote:
    > After a long time, I tried to create an applet. In eclipse it runs
    > perfect as an applet, but in the webpage in the browser it gives a
    > NoClassDefFoundError.


    emf, in case I actually did hurt your feelings as "lipska the cat" and
    perhaps others think I might, I apologize. It isn't about your feelings.
    It's about the information and way you should proceed to succeed.

    If you want to be a good programmer, you have to be able to figure things
    out.

    You will note that the link sends you right to the first piece of relevant
    information about your problem, and the only one we can assist with given
    the paucity of information you have provided.

    The "you did read that before, yes?" is two things - a strong hint that
    you should have already if you didn't, and an acknowledgment that it's
    elementary advice if you did. Either way, it shouldn't hurt your feelings.
    it's an objective question. You did read it before, yes? If not, you
    should have, and should develop the RTFM habit. It's objective. If so, then
    the question simply is to confirm the equally objective data.

    Also, your questions asked for exactly the information given. If you need
    different data, you need different questions. This was also indicated
    in the two answers you got. We also asked for specific missing items.

    If you examine the two answers, you will note a density of useful facts,
    useful questions, and advice for how to deal with the problem.

    You would be wise to follow up on the facts, answer our questions (here,
    publicly), and heed the advice.

    But not blindly. Just heed the good advice.

    --
    Lew
    Lew, Jan 1, 2013
    #5
  6. emf

    Roedy Green Guest

    On Mon, 31 Dec 2012 21:24:33 -0500, emf <> wrote,
    quoted or indirectly quoted someone who said :

    >NoClassDefFoundError


    my condolences. It is bitch to track down since it can have so many
    causes. See
    http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
    --
    Roedy Green Canadian Mind Products http://mindprod.com
    Students who hire or con others to do their homework are as foolish
    as couch potatoes who hire others to go to the gym for them.
    Roedy Green, Jan 1, 2013
    #6
  7. On 01/01/2013 10:35 AM, lipska the kat wrote:
    > On 01/01/13 09:12, Lew wrote:
    >> lipska the kat wrote:
    >>> You really are an objectionable little oike aren't you.

    >>
    >> Yes, I'm afraid I am.
    >>
    >>> Is there really any reason to be so rude ?

    >>

    > [snip]
    >>
    >> But perhaps you yourself are not of such advanced skill to find such
    >> behavioral failure an imposition.

    >
    > Ah yes, that must be it.


    Forget it, he's a complete idiot.

    I put him into my killfile some time ago, but then I removed him because
    it's so funny reading his posts...

    Magnus
    Magnus Warker, Jan 2, 2013
    #7
  8. emf

    Roedy Green Guest

    On Tue, 1 Jan 2013 01:12:01 -0800 (PST), Lew <>
    wrote, quoted or indirectly quoted someone who said :

    >Well, now, let's wonder at who's being rude.

    Oh come on Lew. You are the rudest person I have ever encountered in
    my life. Your purpose of existence is to put down others and
    discourage them.
    --
    Roedy Green Canadian Mind Products http://mindprod.com
    Students who hire or con others to do their homework are as foolish
    as couch potatoes who hire others to go to the gym for them.
    Roedy Green, Jan 2, 2013
    #8
  9. emf

    Arne Vajhøj Guest

    On 1/2/2013 12:49 PM, Roedy Green wrote:
    > On Tue, 1 Jan 2013 01:12:01 -0800 (PST), Lew <>
    > wrote, quoted or indirectly quoted someone who said :
    >
    >> Well, now, let's wonder at who's being rude.

    > Oh come on Lew. You are the rudest person I have ever encountered in
    > my life.


    That may be true.

    But then I will conclude that you have not seen much.

    > Your purpose of existence is to put down others and
    > discourage them.


    Are you reading his mind? Or just someone that has never
    understood concepts like facts?

    Arne
    Arne Vajhøj, Jan 3, 2013
    #9
  10. emf

    emf Guest

    On 2012-12-31 21:36 Arne Vajhøj wrote:
    > On 12/31/2012 9:24 PM, emf wrote:
    >> After a long time, I tried to create an applet. In eclipse it runs
    >> perfect as an applet, but in the webpage in the browser it gives a
    >> NoClassDefFoundError.
    >>
    >> I even tried my very first program, HelloWorldApplet, but I got again
    >> the same problem.
    >>
    >> What kind of problem is this? Is it a compilation issue? Or is it an
    >> eclipse problem? At this stage I would be happy to have the
    >> HelloWorldApplet run: I feel if I this runs, my other program will run
    >> too.

    >
    > Impossible to say without more info.
    >
    > It could be that the class/jar file is not correctly placed
    > or is not correctly served by the web server.
    >
    > Arne


    Thanks everybody for your replies and sorry for not having been more
    specific. I really did not expect to generate such a long thread, this
    is really a lively newsgroup! The problem was that eclipse (that's how
    it is capitalized it in the program's logo) insists on putting all
    classes into packages. When putting an applet in a webpage, the class
    has to be *in a folder with the same name* as it originally was in
    eclipse, and the webpage has to *call it from outside the folder*. I
    considered installing the SDK and compiling the applet without the
    package line on top, because I prefer to have the html and the applet in
    the same folder, but that has its own problems, so at this point since
    the program at last is working in my browser from an html file I count
    my blessings.

    Eustace

    --
    Date Calculator with all-purpose JS code
    https://files.nyu.edu/emf202/public/js/dateCalculator.html
    emf, Jan 7, 2013
    #10
  11. On 1/6/2013 7:19 PM, emf wrote:
    > On 2012-12-31 21:36 Arne Vajhøj wrote:
    >> On 12/31/2012 9:24 PM, emf wrote:
    >>> After a long time, I tried to create an applet. In eclipse it runs
    >>> perfect as an applet, but in the webpage in the browser it gives a
    >>> NoClassDefFoundError.
    >>>
    >>> I even tried my very first program, HelloWorldApplet, but I got again
    >>> the same problem.
    >>>
    >>> What kind of problem is this? Is it a compilation issue? Or is it an
    >>> eclipse problem? At this stage I would be happy to have the
    >>> HelloWorldApplet run: I feel if I this runs, my other program will run
    >>> too.

    >>
    >> Impossible to say without more info.
    >>
    >> It could be that the class/jar file is not correctly placed
    >> or is not correctly served by the web server.

    >
    > Thanks everybody for your replies and sorry for not having been more
    > specific. I really did not expect to generate such a long thread, this
    > is really a lively newsgroup! The problem was that eclipse (that's how
    > it is capitalized it in the program's logo) insists on putting all
    > classes into packages. When putting an applet in a webpage, the class
    > has to be *in a folder with the same name* as it originally was in
    > eclipse, and the webpage has to *call it from outside the folder*. I
    > considered installing the SDK and compiling the applet without the
    > package line on top, because I prefer to have the html and the applet in
    > the same folder, but that has its own problems, so at this point since
    > the program at last is working in my browser from an html file I count
    > my blessings.


    You really should use packages.

    If you switch from deploying many class files to deploying a
    single jar file, then you can have that jar file in same dir
    as the html file.

    Arne
    Arne Vajhøj, Jan 7, 2013
    #11
  12. emf

    Lew Guest

    emf wrote:
    > The problem was that eclipse (that's how
    >
    > it is capitalized it in the program's logo)


    It is consistently spelled "Eclipse" everywhere in the text on their website.
    http://www.eclipse.org/

    The little header on the browser says, "Eclipse - The Eclipse Foundation".

    Logos are not normative for the spelling of proper nouns. It is a specious
    justification.

    --
    Lew
    Lew, Jan 7, 2013
    #12
  13. emf

    emf Guest

    On 2013-01-06 19:26 Arne Vajhøj wrote:
    > On 1/6/2013 7:19 PM, emf wrote:
    >> On 2012-12-31 21:36 Arne Vajhøj wrote:
    >>> On 12/31/2012 9:24 PM, emf wrote:
    >>>> After a long time, I tried to create an applet. In eclipse it runs
    >>>> perfect as an applet, but in the webpage in the browser it gives a
    >>>> NoClassDefFoundError.
    >>>>
    >>>> I even tried my very first program, HelloWorldApplet, but I got again
    >>>> the same problem.
    >>>>
    >>>> What kind of problem is this? Is it a compilation issue? Or is it an
    >>>> eclipse problem? At this stage I would be happy to have the
    >>>> HelloWorldApplet run: I feel if I this runs, my other program will run
    >>>> too.
    >>>
    >>> Impossible to say without more info.
    >>>
    >>> It could be that the class/jar file is not correctly placed
    >>> or is not correctly served by the web server.

    >>
    >> Thanks everybody for your replies and sorry for not having been more
    >> specific. I really did not expect to generate such a long thread, this
    >> is really a lively newsgroup! The problem was that eclipse (that's how
    >> it is capitalized it in the program's logo) insists on putting all
    >> classes into packages. When putting an applet in a webpage, the class
    >> has to be *in a folder with the same name* as it originally was in
    >> eclipse, and the webpage has to *call it from outside the folder*. I
    >> considered installing the SDK and compiling the applet without the
    >> package line on top, because I prefer to have the html and the applet in
    >> the same folder, but that has its own problems, so at this point since
    >> the program at last is working in my browser from an html file I count
    >> my blessings.

    >
    > You really should use packages.
    >
    > If you switch from deploying many class files to deploying a
    > single jar file, then you can have that jar file in same dir
    > as the html file.
    >
    > Arne


    I really can't see why packages are preferable, but the jar option is OK.

    emf

    --
    It ain't THAT, babe! - A radical reinterpretation
    https://files.nyu.edu/emf202/public/bd/itaintmebabe.html
    emf, Jan 9, 2013
    #13
  14. emf

    Lew Guest

    emf wrote:
    > I really can't see why packages are preferable, but the jar option is OK.


    The two are independent of each other.

    Packages are a way to organize classes. Don't use the default (unnamed) package.

    Why is explained in the Java tutorial.

    "To make types easier to find and use, to avoid naming conflicts, and to
    control access".

    You really should never use the default package.

    JARs are a way to distribute applications. Different thing. JARs contain
    packages.

    Learn to do it right. If you were to have done the research into your own
    question, that would have made it a useful question. Instead, you used the
    question, or rather the fact that you were ignorant of the answer, as a
    reason not to do the right thing.

    This is not the way to become a good programmer. Instead, when you encounter
    a question, seek to answer it.

    Then instead of "I don't see why" and perennial lack of skill in Java or
    whatever, you'll have, "I got this!"

    --
    Lew
    Lew, Jan 9, 2013
    #14
  15. On 1/9/2013 1:18 AM, emf wrote:
    > On 2013-01-06 19:26 Arne Vajhøj wrote:
    >> On 1/6/2013 7:19 PM, emf wrote:
    >>> On 2012-12-31 21:36 Arne Vajhøj wrote:
    >>>> On 12/31/2012 9:24 PM, emf wrote:
    >>>>> After a long time, I tried to create an applet. In eclipse it runs
    >>>>> perfect as an applet, but in the webpage in the browser it gives a
    >>>>> NoClassDefFoundError.
    >>>>>
    >>>>> I even tried my very first program, HelloWorldApplet, but I got again
    >>>>> the same problem.
    >>>>>
    >>>>> What kind of problem is this? Is it a compilation issue? Or is it an
    >>>>> eclipse problem? At this stage I would be happy to have the
    >>>>> HelloWorldApplet run: I feel if I this runs, my other program will run
    >>>>> too.
    >>>>
    >>>> Impossible to say without more info.
    >>>>
    >>>> It could be that the class/jar file is not correctly placed
    >>>> or is not correctly served by the web server.
    >>>
    >>> Thanks everybody for your replies and sorry for not having been more
    >>> specific. I really did not expect to generate such a long thread, this
    >>> is really a lively newsgroup! The problem was that eclipse (that's how
    >>> it is capitalized it in the program's logo) insists on putting all
    >>> classes into packages. When putting an applet in a webpage, the class
    >>> has to be *in a folder with the same name* as it originally was in
    >>> eclipse, and the webpage has to *call it from outside the folder*. I
    >>> considered installing the SDK and compiling the applet without the
    >>> package line on top, because I prefer to have the html and the applet in
    >>> the same folder, but that has its own problems, so at this point since
    >>> the program at last is working in my browser from an html file I count
    >>> my blessings.

    >>
    >> You really should use packages.
    >>
    >> If you switch from deploying many class files to deploying a
    >> single jar file, then you can have that jar file in same dir
    >> as the html file.

    >
    > I really can't see why packages are preferable, but the jar option is OK.


    There are several good reasons to use packages.

    1) It helps you structure you code (UML has packages too for
    the same purpose).

    2) You can encapsulate you code better by using packages and
    package visibility so that internal code is not public.

    3) You avoid name conflicts between your code and other code
    by putting your code in its own namespace(s).

    4) Your code can be called from code in a namespace.

    Arne
    Arne Vajhøj, Jan 10, 2013
    #15
  16. emf

    Lew Guest

    Arne Vajhøj wrote:
    > emf wrote:
    >> I really can't see why packages are preferable, but the jar option is OK..

    >
    > There are several good reasons to use packages.
    >
    > 1) It helps you structure you code (UML has packages too for
    > the same purpose).
    >
    > 2) You can encapsulate you code better by using packages and
    > package visibility so that internal code is not public.
    >
    > 3) You avoid name conflicts between your code and other code
    > by putting your code in its own namespace(s).
    >
    > 4) Your code can be called from code in a namespace.


    In other words, those same benefits mentioned in the Java Tutorial, op. cit..

    --
    Lew
    Lew, Jan 10, 2013
    #16
    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. qazmlp
    Replies:
    6
    Views:
    13,391
    Joseph Millar
    Jul 11, 2003
  2. Monsieur Le Maire

    NoClassDefFoundError

    Monsieur Le Maire, Jul 21, 2003, in forum: Java
    Replies:
    2
    Views:
    417
    Roedy Green
    Jul 21, 2003
  3. netpro2k
    Replies:
    2
    Views:
    1,067
    netpro2k
    Aug 21, 2003
  4. keith
    Replies:
    0
    Views:
    300
    keith
    Oct 17, 2003
  5. Replies:
    1
    Views:
    2,112
    Irmen de Jong
    Jun 22, 2004
Loading...

Share This Page