Java Manifest.mf classpath issues

前端 未结 2 1402
清酒与你
清酒与你 2021-01-14 19:20

I\'ve been trying to run a jar file - let\'s call it test.jar - that uses the Sybase jconn3.jar on a Unix system.

I have created a MANIFEST.MF file that has the foll

相关标签:
2条回答
  • 2021-01-14 19:29

    The entries in the class-path are either relative to the JAR in which they are embedded (which you have working) or are URLs. To make your absolute paths work, you'll need to convert them to URLs, e.g.,

    file:/opt/sybase13/...

    There's no mechanism for using variables.

    Although the JAR specification doesn't say it clearly, absolute file: scheme URLs do work in the class-path attribute.

    0 讨论(0)
  • 2021-01-14 19:37

    Environment variables are not readed by the classloader AFAIK. However you could add the jar in a configuration script

    Accoding to the specification the entries are relatives to the jar not absolute:

    Class-Path :

    The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.

    http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html #Manifest Specification

    0 讨论(0)
提交回复
热议问题