When I try to run my compiled Java program, I got the following error: Exception in thread “main” java.lang.NoClassDefFoundError:*** What is wrong and how can I fix this?
This is a common error when the CLASSPATH environment variable is not set correctly. Setting it is similar to setting the PATH variable. Go to the Systems program in your Control Panel. Select the Advanced tab and then click on the Environment Variables button. Edit the CLASSPATH variable in Systems variables. Be sure to include the Java library path (e.g. c:\j2sdk\lib where j2sdk is the directory you installed Java2SDK) and the current path (.): .;c:\j2sdk\lib). You are good to go now!
Related Questions
- When I try to run my compiled Java program, I got the following error: Exception in thread "main" java.lang.NoClassDefFoundError:*** What is wrong and how can I fix this?
- When I try to run the dlicfg program, I get an error which says "DLI was built with stub ***.c, and does not support ***". What does that mean?
- Why do I get "Exception in thread main java.lang.NoClassDefFoundError:" when trying to run my first Java Sound program?