简体   繁体   中英

cannot include external jar in my executable jar

I am trying to convert my java application to an executable jar.

I have been able to package it into a jar with all my class files, but still am not able to include the jmf.jar file.

This is my directory structure,

Main dir

src/                  //A dir
--a.java
--b.java
jmf.jar
Manifest.txt

Content of my Manifest.txt file,

Manifest-Version: 1.0 
Ant-Version: Apache Ant 1.7.0  
Main-Class: src/a
Class-Path: .;jmf.jar //also tried ./jmf.jar

By double clicking the .jar file, I am able to run the main function, but the second function uses the jmf.jar throws exception when I tried running the jar file in debug mode, that javax.media not found. This class is in the jmf.jar file, which makes me conclude the jmf.jar file is not being included in the class path or so. So what am I doing wrong? How do I make this executable file?

The command I used to convert it to jar was,

jar cvfm myJar.jar Manifest.txt src\*.class jmf.jar

清单中的Class-Path条目所引用的jar文件一定不能在jar内,而必须在jar之外,如jar教程中所述

如果使用的是JMF,则需要在与可执行jar相同的目录中包含jmf.jar和jmf.properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM