A.Rouze
A.Rouze

Reputation: 51

Class not found after jar export

It should be simple but I can't run my JAR file.

My error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/pdfbox/pdmodel/font/PDFont

I'm trying to follow some post like this: Stackoverflow

But nothing.

I think this error is because I haven't take external libraries on my project.

How to create a JAR file with libraries in Intellij ?

Anyone have a solution ?

Upvotes: 1

Views: 3582

Answers (3)

Optimus
Optimus

Reputation: 709

Click on File -> Project Structure->Artifacts->'+'->Jar->From modules with dependencies-> Select the module folder and Main Class.Click on Apply and then you export the artifact

Now with all the required libraries in the class path your program should work as expected

Upvotes: 0

Manish
Manish

Reputation: 59

  1. go to File from File menu
  2. click on Project Structure
  3. choose Modules at the left panel
  4. select Dependencies tab and start adding external jars.

After adding the dependencies, you can export your project as jar if you wish.

  • Again go to File
  • Project Structure
    • Project Settings
    • Artifacts
  • extract Jar

    If you still get the error, please cross check your classpath for the missing class, you might have got classnotfound exception or ExceptionInInitializerError before.

Upvotes: 1

Andres
Andres

Reputation: 10717

Check if your classpath includes the jar

Upvotes: 1

Related Questions