NoClassDefFoundError

E

emf

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
 
A

Arne Vajhøj

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
 
L

Lew

Arne said:
emf said:
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?

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

Which would be ...?

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

What is the code?

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.

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.

"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?
 
L

Lew

lipska said:
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.
 
L

Lew

emf said:
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.
 
M

Magnus Warker

lipska said:
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
 
R

Roedy Green

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.
 
A

Arne Vajhøj

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
 
E

emf

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
 
A

Arne Vajhøj

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
 
L

Lew

emf said:
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.
 
E

emf

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
 
L

Lew

emf said:
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!"
 
A

Arne Vajhøj

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
 
L

Lew

Arne said:
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..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,059
Members
48,769
Latest member
Clifft

Latest Threads

Top