skrilmps
skrilmps

Reputation: 695

java.lang.ClassNotFoundException in runnable jar exported by Eclipse

I am using Eclipse to export my project into a runnable jar.

I'm using a few libraries, namely Apache commons, Java FX, and GSON.

I have added those libraries to my Build Path inside Eclipse: screenshot of Eclipse Java Build Path

When exporting, I choose to package the required libraries into the generated jar: screenshot of Eclipse export to runnable jar This creates a jar called Editor.jar

However when I do "java -jar Editor.jar" I get the java.lang.ClassNotFoundException for the class EqualsBuilder which is a part of Apache commons.

I've tried copying the apache commons-lang3-3.4.jar file into the working directory. I've also tried adding "-cp commons-lang3-3.4.jar" before the "-jar". Still I always get the ClassNotFoundException.

Does anyone see what I'm missing? Thanks.

Upvotes: 0

Views: 1256

Answers (1)

yunus
yunus

Reputation: 2545

Select that option while exporting , If u dont select that option then u might have to resolve the dependencies on your own using -cp

enter image description here

Upvotes: 1

Related Questions