我试图将 native 库包含到 jar 文件中。虽然我找到了应该如何完成,但还是缺少一些东西。这是 list 文件。
Manifest-Version: 1.0
Class-Path: .
Main-Class: ListMediaDevices
Name: library
URL: http://jspeex.sourceforge.net/
Library-Version: 0.9.7
Library-Name: JSpeex
Name: build
Build-Date: 10/05/2010 18:59
Built-With: Linux 2.6.32-21-generic amd64
Built-By: damencho
Bundle-NativeCode:
lib/jnawtrenderer.dll;
lib/jndirectshow.dll;
lib/jnffmpeg.dll;
lib/jng722.dll;
lib/jnopus.dll;
lib/jnportaudio.dll;
lib/jnscreencapture.dll;
lib/jnspeex.dll;
lib/jnwincoreaudio.dll;
osname=Win32;processor=x86
根据规范,我确实使用 UTF8 编码并以新行结束文件。一些如何加载 jar 文件
java -jar pr.jar give "Error: An unexpected error occurred while trying to open file"
为了复制问题,我删除了整个包头以及 lib 参数,并添加了任意头“xyz:”,它似乎给出了相同的错误,所以我得出结论,有些地方我的实现无法识别“Bundle-NativeCode:” header 。
其他信息
java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
正在使用的库是libjitsi.jar
最佳答案
我认为您应该在 Bundle-NativeCode
header 中使用单个空格而不是制表符或多个空格作为 JAR File Specification, Name-Value pairs and Sections指定:
header: name : value
name: alphanum *headerchar
value: SPACE *otherchar newline *continuation
continuation: SPACE *otherchar newline
这是一个适合我的示例 list .mf 片段:
Created-By: Apache Maven Bundle Plugin
Bundle-NativeCode: aaaaaaaaaaa.dll, bbbbbbbbbbb.dll, cccccccccc.dll, d
ddddddddddddddd.dll, eeeeeeeeee.dll, ffffffff.dll, ggggggggggggggg.dl
l, hhhhhhhhhhhhhhhhhh.dll, iiiiii.dll
关于java - bundle -NativeCode : header in MANIFEST file give "Error: An unexpected error occurred while trying to open file pr.jar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14068000/