简体   繁体   English

Bundle-NativeCode:MANIFEST文件中的标头给出“错误:尝试打开文件pr.jar时发生意外错误”

[英]Bundle-NativeCode: header in MANIFEST file give “Error: An unexpected error occurred while trying to open file pr.jar”

I was attempting to include natives libraries into a jar file. 我试图将本机库包含到jar文件中。 Though i found how it should be done, there something that is missing. 尽管我发现应该怎么做,但是仍然缺少一些东西。 This is the manifest file. 这是清单文件。

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

As per specification i do use UTF8 encoding and end the file with a new line. 按照规范,我确实使用UTF8编码,并以新行结尾文件。 Some how loading the jar file 一些如何加载jar文件

java -jar pr.jar give "Error: An unexpected error occurred while trying to open file"

In order to replicate the issue, i remove the entire bundle header along with the lib parameters and added an arbitrary header "xyz:" it seems to give the same error, so i conclude, some where my implementation can't identify "Bundle-NativeCode:" Header. 为了解决这个问题,我删除了整个bundle标头以及lib参数,并添加了一个任意标头“ xyz:”,它似乎给出了相同的错误,因此我得出结论,在某些地方我的实现无法识别“ Bundle- NativeCode:“标题。

Other information 其他资讯

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)

Library being used is libjitsi.jar 正在使用的库是libjitsi.jar

I think you should use single spaces instead of tabs or multiple spaces in the Bundle-NativeCode header as the JAR File Specification, Name-Value pairs and Sections specifies: 我认为您应该在Bundle-NativeCode标头中使用单个空格而不是制表符或多个空格,因为JAR文件规范,名称-值对和Sections指定:

header:            name : value
name:              alphanum *headerchar
value:             SPACE *otherchar newline *continuation
continuation:      SPACE *otherchar newline

Here is a sample manifest.mf snippet which works for me: 这是一个对我有用的示例manifest.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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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