I have tried to write a program where i want to access class in a jar.
I am using netbeans as ide,Windows 7 os and have added jar in the libraries.
But i keep getting the error.
Exception in thread “main” java.lang.NoClassDefFoundError:after setting PATh and CLASSPATH
I have set the PATh variable to my <jdk directory>/bin;
CLASSPATH to %CLASSPATH%;
and JAVA_HOME to <jdk directory>
<jdk directory> =C:\Program Files\Java\jdk1.7.2
You should have the jar file in your classpath to access the classes inside it. Moreover when you run a program from an IDE it overrides any classpath settings you do at system level. Please check your build path in the IDE.