English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

D:\acn>javac pc.java
D:\acn>java pc
Exception in thread "main" java.lang.NoClassDefFoundError: pc

what should i do for this i hv done every possible thing.even i hv installed it again but its giving me same problem the program is compiling but not running its giving me the above exception error.
i hv jdk1.4.even i hv tried with jre1.5.0_11.

2007-02-14 22:33:57 · 6 answers · asked by Ashwini T 1 in Computers & Internet Programming & Design

6 answers

Set the classpath variable to current directory and try.
copy paste the following in ur console and try.
SET CLASSPATH=%CLASSPATH%;.;

Best Wishes

2007-02-14 22:40:42 · answer #1 · answered by Lionking 1 · 0 0

Hi

First verify that your IE settings are allowing the java to be install as a plug-in then , unistall the java software , reboot , and run ANY java application that requires it , then after xp gives and error saying that it need java bla bla bla , thats when you install the NEW java

2007-02-15 06:40:58 · answer #2 · answered by ? 4 · 0 0

Don't worry, almost every Java programmer faces this error at some time in their life.

Your classpath is incorrectly setup.

try this
D:\acn>java -classpath . pc

my guess is that your classpath is non-standard for the installer you used because you installed it in Harddrive D instead of C. The installer wasn't smart enough to put it where you needed.

2007-02-15 06:40:50 · answer #3 · answered by Jason W-S 4 · 0 0

The error can be with the classpath, or may be that the file pc.java do not have any class with name pc. Just check. the file name and class name should be macthed in Java.

2007-02-16 03:06:50 · answer #4 · answered by manoj Ransing 3 · 0 0

The problem may not be wich version of java you have, but your program that is trying to utilize java to run.

Whatever program or game you are trying to run that is giving the errors, uninstall the program you are trying to use, reboot and then reinstall it.

2007-02-15 06:41:22 · answer #5 · answered by Timothy L 3 · 0 0

you need to have jdk 1.5 with jre 1.5. check your java folder in C: program files. You must have both jre and jdk folders with the same version. you could go to the java.sun.com download page for this. they also have a package that includes jdk, jre, and netbeans, if you're using that program.

at the same time, make sure that you compiled the program with the same version you're running it with. if you compiled in on a pc with 1.6, it would produce errors if you try to run or recompile it with another machine that uses a different version.

2007-02-15 06:43:12 · answer #6 · answered by nikki 3 · 0 0

fedest.com, questions and answers