0

I created a jar file with IntelliJ. I tried to open it with the cmd. But i got java.lang.UnsupportedClassVersionError because i build the jar with JDK 15 and it tried open it with Java 8, so i tried open it with Java 15 and got this Error: Unable to initialize main class sample.JobegaGUI Caused by: java.lang.NoClassDefFoundError: com/itextpdf/layout/element/IBlockElement

I used this command in the folder where the jar is saved. I hoped the command was right.

"C:\Program Files\Java\jdk-15.0.2\bin\java" -jar Jobega.jar

I'm using iText7-Core-7.1.3

I don't know what i can do anymore. I hope you can help me. Just say if you need to see some files.

Berni
  • 1
  • 1
    here is your problem: Caused by: java.lang.NoClassDefFoundError: com/itextpdf/layout/element/IBlockElement – Stultuske Jun 21 '21 at 07:32
  • 1
    *"I'm using iText7-Core-7.1.3"* looking at how you're launching your application you're not putting the itext jar in your classpath. – Federico klez Culloca Jun 21 '21 at 07:35
  • You can either put the itext jar in your classpath or package a **fat jar**. See more at https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven – chenzhongpu Jun 21 '21 at 07:52
  • the problem is i dont use a itext jar it is a folder with the different jars in it. I added it under project setting to the libaries. – Berni Jun 21 '21 at 07:55
  • @Berni you still need to add those jars to the classpath if they're needed at runtime. See [this answer](https://stackoverflow.com/a/15930980/133203) for instructions on how to do it. – Federico klez Culloca Jun 21 '21 at 08:02
  • Under Project Settings -> Modules -> Dependencies i add all Jars and add them under Classpath in the Manifest.mf file build the jar new and try open it. And the same Error appears – Berni Jun 21 '21 at 08:24
  • i think im just too dumb – Berni Jun 21 '21 at 09:08

0 Answers0