By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

getting error: java.lang.NoClassDefFoundError

P: n/a
Hi Guys,

im starting out in java and i'm getting the error: Exception in thread
"main" java.lang.NoClassDefFoundError: blurf

if i run "javac blurf.java", it compiles fine and without any troubles.

when i try to run it (its a simple hello world program) i get the above
error.

i need some help :)

-nat
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"NathanK" <me@me.com> wrote in message
news:40******@duster.adelaide.on.net...
Hi Guys,

im starting out in java and i'm getting the error: Exception in thread
"main" java.lang.NoClassDefFoundError: blurf

if i run "javac blurf.java", it compiles fine and without any troubles.

when i try to run it (its a simple hello world program) i get the above
error.

i need some help :)

-nat


Most likely a classpath problem. Read about the java classpath in your book
or somewhere in the java tutorial at java.sun.com, which has been down all
day.

Try "java -classpath . blurf". If that works, the classpath is your problem.
Please post further questions in comp.lang.java.help.
Jul 17 '05 #2

P: n/a
NathanK wrote:
Hi Guys,

im starting out in java and i'm getting the error: Exception in thread
"main" java.lang.NoClassDefFoundError: blurf

if i run "javac blurf.java", it compiles fine and without any troubles.

when i try to run it (its a simple hello world program) i get the above
error.

i need some help :)

-nat

Two things, nat. 1) Ensure that you have a 'main' method, and 2) ensure
that if you are using a "package" statement (on top of the file), that
your directory structure matches.
-nat

Jul 17 '05 #3

P: n/a
NathanK <me@me.com> wrote in message news:<40******@duster.adelaide.on.net>...
Hi Guys,

im starting out in java and i'm getting the error: Exception in thread
"main" java.lang.NoClassDefFoundError: blurf

if i run "javac blurf.java", it compiles fine and without any troubles.

when i try to run it (its a simple hello world program) i get the above
error.

i need some help :)

-nat


(1)Your current directory from where you issue javac/java command
shoud match the directory where your blurf.java/.class are stored.
(2)Your CLASSPATH should have . in it. Dot means current directory
wherever it is.

[autoexec.bat used in Win 95/98/Me]
SET CLASSPATH=.;%CLASSPATH%

[other Windows]
Goto control panel.
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.