Java help needed

M

mhk

Hi ,

i am having a problem while running java file , i mean i can compile
file correctly using "javac filename.java " but when i try to run it
using "java filename", i get following error

Exception in thread "main" java.lang.NoClassDefFoundError

I checked it on the web but didnt get any help. definately its about
missing class path problem but i really dont know how to solve it.

Please help me ...

Thanks in advance.

jeff
 
C

Christophe Vanfleteren

mhk said:
Hi ,

i am having a problem while running java file , i mean i can compile
file correctly using "javac filename.java " but when i try to run it
using "java filename", i get following error

Exception in thread "main" java.lang.NoClassDefFoundError

I checked it on the web but didnt get any help. definately its about
missing class path problem but i really dont know how to solve it.

Please help me ...

Thanks in advance.

jeff

try java -cp . filename

That sets the classpath to the current directory.
If you need to have other things in your classpath, just append the . to the
CLASSPATH environment variable.
 
J

John C. Bollinger

mhk said:
Hi ,

i am having a problem while running java file , i mean i can compile
file correctly using "javac filename.java " but when i try to run it
using "java filename", i get following error

Exception in thread "main" java.lang.NoClassDefFoundError

I checked it on the web but didnt get any help. definately its about
missing class path problem but i really dont know how to solve it.

Very likely you have a classpath problem. You may need to instruct the
JVM to look in the working directory for classes. For instance,

java -cp . MyClass


John Bollinger
(e-mail address removed)
 
M

mhk

Thank you sooooooo much



Very likely you have a classpath problem. You may need to instruct the
JVM to look in the working directory for classes. For instance,

java -cp . MyClass


John Bollinger
(e-mail address removed)
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top