Good day! Faced such a problem: the JRE cannot find the required library, although it is listed in the manifest.

Here is the manifesto:

Manifest-Version: 1.0 Class-Path: jintellitype-1.3.7.jar Main-Class: yanislavPackage.CloudBufferClient 

.jar file structure:

.jre

And the error itself when running from the console:

cmd

(The error, of course, is related to the problem in finding the library: HotKeyListener (see error) comes first in the import, and if you swap it with any other class imports from this library, the corresponding error will be issued)

Maybe someone faced a similar problem and can help me?

    1 answer 1

    I will quote Java SE Tutorial

    Attention : The Class-Path header in the manifest points to classes or JAR files on the local network, not classes and JAR files inside your JAR file or available on the Internet. To load classes from a JAR file inside your JAR file, you need to implement your class loader. For example, if the file MyJar.jar contains inside MyUtils.jar , you cannot use the Class-Path header in the manifest of the file MyJar.jar , which will load the classes from MyUtils.jar .

    In general, do not do that.

    • Or remove the jintellitype-1.3.7.jar from your JAR file and put it side by side.

    • Or, do what they call the Uber JAR: jintellitype-1.3.7.jar contents of jintellitype-1.3.7.jar with your JAR. Here, as @Etki mentioned, the maven-shade-plugin is useful if you use maven.

    • I'll try, thank you. It is strange that IDEA (with which I did this jar) stuffed the library exactly inside .jar - Janislav
    • one
      IDEA puts exactly what you have in Project Structure → Artifacts - Nofate in JAR