0
votes

I created a Java project in Eclipse and created a simple class with a main method.

Problem: when I run the program(without any server etc), I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException at autoPEC.main(autoPEC.java:6) Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 1 more

What I tried to solve the problem: included path to commons-codec.jar in the environment variables JAVA_HOME by putting a semicolon after the jdk path

Result: class still does not run

I think that the problem could be that I am not correctly including the classpath. How should I do this?

2
Unless you tell us where you put the jar file, and how you configured the project build path in Eclipse, it will be hard for anyone to help you. - Jim Garrison
Hello, I edited the what I tried part. - Java dev
@Javadev: Do you want to solve the problem of running you project in eclipse? Or any other type of execution of your program? Please provide a picture of your project's classpath in eclipse. - STaefi
thanks @STaefi. I could solve it :) - Java dev

2 Answers

0
votes

Google the missing jar and include it in the Java Build path

0
votes

Reason for this exception is missing of a jar. please add the jar(Commons-codec.jar) file needed for this org.apache.commons.codec.DecoderException

Download it from here
http://commons.apache.org/proper/commons-codec/download_codec.cgi then put it in your classpath