0

Had a 3rd parties working JAR file in my own project, but I ran into a problem: i needed some customization to do.

  1. Forked a repository from Github.
  2. Modified the source code
  3. Exported the JAR: Left click > Export > Java > JAR file > Default settings
  4. Imported the JAR to my own Android project: Left click > Import > File system & Left Click on project > Properties > Java Build Path > Add JARs > OK

Now, when I run my program (which was working fine with 3rd parties official JAR) I run into exception on runtime:

11-10 06:22:05.912: E/AndroidRuntime(1125): Caused by: java.lang.NoClassDefFoundError: org.jsoup.Jsoup

When I extract the JAR file, then it contains all the needed class files (including org.jsoup.Jsoup).

NoClassDefFoundError - error reading the class definition. This typically happens when the class in question has static blocks or members which use a Class that's not found by the ClassLoader. Source

As I understand, this seems to be some kind of exported JAR classpath problem?

Community
  • 1
  • 1
Indrek Kõue
  • 6,449
  • 8
  • 37
  • 69

1 Answers1

0

Yeah , NoClassDefFoundError usually means the classpath problem , especially there are many class loaders. But I think yours is a simple case.

Are you sure it's " Java Build Path > Add JARs"? It's a " Java Build Path > Add External JARs" option in my memory .Maybe you can try.

biaobiaoqi
  • 1,098
  • 12
  • 18