title: Having absolute path in Manifest.mf Class-Path
body: <p>I'm trying to use an absolute path in the <code>Class-Path</code> portion of a MANIFEST.MF file, but it doesn't seem to work.  </p>
  
  <p>The reason I'm using an absolute path is that the library in question is a proprietary library that I'm not at liberty to redistribute. It is installed on corporate machines on a constant path (/opt/...), so it makes sense for me to use this absolute path.  </p>
  
  <p>My manifest file is as follows:  </p>
  
  <pre><code>Manifest-Version: 1.0
  Archiver-Version: Plexus Archiver
  Built-By: Me
  Class-Path: /opt/path/to/library.jar
  Created-By: Apache Maven 3.3.9
  Build-Jdk: 1.8.0_102
  Main-Class: com.me.Main
  </code></pre>
  
  <p>The program runs fine (so the main class etc. is set correctly), but as soon as I try to load a class from <code>library.jar</code> I get a <code>NoClassDefFoundError</code>.  </p>
  
  <p>I have tried adding the following code the beginning of my main method:  </p>
  
  <pre><code>ClassLoader cl = ClassLoader.getSystemClassLoader();
  
  URL[] urls = ((URLClassLoader)cl).getURLs();
  
  for(URL url: urls){
      System.out.println(url.getFile());
  }
  </code></pre>
  
  <p>but it only prints out the name of my jar file.  </p>
  
  <p>Apparently, running with "java -jar" also ignores the <code>$CLASSPATH</code> system variable, so even that does not seem to be an option.  </p>
  
  <p>Is there a solution besides copying (or sym-linking) the library to the location of my own jar?  </p>