java-native-access / jna

Java Native Access
Other
8.4k stars 1.67k forks source link

JNA.JAR is invalid OSGi bundle #63

Closed brettwooldridge closed 12 years ago

brettwooldridge commented 12 years ago

Due to a simple blank line in the MANIFEST.MF file, Eclipse treats the jna.jar file as an invalid OSGi bundle.

Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.2 Created-By: 1.6.0_29-b11-402-10M3527 (Apple Inc.) Main-Class: com.sun.jna.Native

Name: com/sun/jna/ Implementation-Title: com.sun.jna Implementation-Vendor: JNA Development Team Implementation-Version: 3.4.0 (b541) Specification-Title: Java Native Access (JNA) Specification-Vendor: JNA Development Team Specification-Version: 3 Bundle-ManifestVersion: 2 Bundle-Name: jna Bundle-Description: JNA Library Bundle-SymbolicName: com.sun.jna Bundle-Version: 3 Bundle-RequiredExecutionEnvironment: J2SE-1.4 Bundle-Vendor: JNA Development Team Bundle-ActivationPolicy: lazy Export-Package: com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32 Bundle-NativeCode: com/sun/jna/win32-x86/jnidispatch.dll; processor=x8 6;osname=win32, com/sun/jna/win32-amd64/jnidispatch.dll; processor=x8 6-64;osname=win32, com/sun/jna/w32ce-arm/jnidispatch.dll; processor=a rm;osname=wince, com/sun/jna/sunos-x86/libjnidispatch.so; processor= x86;osname=sunos, com/sun/jna/sunos-amd64/libjnidispatch.so; processo r=x86-64;osname=sunos, com/sun/jna/sunos-sparc/libjnidispatch.so; pro cessor=sparc;osname=sunos, com/sun/jna/sunos-sparcv9/libjnidispatch.s o; processor=sparcv9;osname=sunos, com/sun/jna/linux-ppc/libjnidispa tch.so; processor=ppc;osname=linux, com/sun/jna/linux-ppc64/libjnidis patch.so; processor=ppc64;osname=linux, com/sun/jna/linux-i386/libjni dispatch.so; processor=x86;osname=linux, com/sun/jna/linux-amd64/libj nidispatch.so; processor=x86-64;osname=linux, com/sun/jna/linux-arm/l ibjnidispatch.so; processor=arm;osname=linux, com/sun/jna/linux-ia64/ libjnidispatch.so; processor=ia64;osname=linux, com/sun/jna/openbsd- i386/libjnidispatch.so; processor=x86;osname=openbsd, com/sun/jna/fre ebsd-i386/libjnidispatch.so; processor=x86;osname=freebsd, com/sun/jn a/freebsd-amd64/libjnidispatch.so; processor=x86-64;osname=freebsd,
com/sun/jna/darwin/libjnidispatch.jnilib; osname=macos,

The blank line between the Main-Class: header and the Name: header needs to be removed.

brettwooldridge commented 12 years ago

Forgot something ... the trailing comma (,) after "osname=macos," on the last line of the manifest is also invalid. After correcting these two issues locally, Eclipse was able to treat the jna.jar as an OSGi bundle.

brettwooldridge commented 12 years ago

I spoke too soon, another minor correction. The "Bundle-Version" header says "3" as the value, but OSGi seems to want a three-part version, for example "3.4.0" (for version 3.4).

brettwooldridge commented 12 years ago

See this enhancement request:

http://java.net/jira/browse/JNA-141

The items above are still insufficent without this enhancement.

twall commented 12 years ago

Are you certain that's why eclipse treats it as invalid? because ant is generating the manifest, so if it's not a valid manifest that's an ant bug and if it is a valid manifest that's an eclipse bug.

On Mar 23, 2012, at 12:46 AM, brettwooldridge wrote:

Due to a simple blank line in the MANIFEST.MF file, Eclipse treats the jna.jar file as an invalid OSGi bundle.

Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.2 Created-By: 1.6.0_29-b11-402-10M3527 (Apple Inc.) Main-Class: com.sun.jna.Native

Name: com/sun/jna/ Implementation-Title: com.sun.jna Implementation-Vendor: JNA Development Team Implementation-Version: 3.4.0 (b541) Specification-Title: Java Native Access (JNA) Specification-Vendor: JNA Development Team Specification-Version: 3 Bundle-ManifestVersion: 2 Bundle-Name: jna Bundle-Description: JNA Library Bundle-SymbolicName: com.sun.jna Bundle-Version: 3 Bundle-RequiredExecutionEnvironment: J2SE-1.4 Bundle-Vendor: JNA Development Team Bundle-ActivationPolicy: lazy Export-Package: com.sun.jna,com.sun.jna.ptr,com.sun.jna.win32 Bundle-NativeCode: com/sun/jna/win32-x86/jnidispatch.dll; processor=x8 6;osname=win32, com/sun/jna/win32-amd64/jnidispatch.dll; processor=x8 6-64;osname=win32, com/sun/jna/w32ce-arm/jnidispatch.dll; processor=a rm;osname=wince, com/sun/jna/sunos-x86/libjnidispatch.so; processor= x86;osname=sunos, com/sun/jna/sunos-amd64/libjnidispatch.so; processo r=x86-64;osname=sunos, com/sun/jna/sunos-sparc/libjnidispatch.so; pro cessor=sparc;osname=sunos, com/sun/jna/sunos-sparcv9/libjnidispatch.s o; processor=sparcv9;osname=sunos, com/sun/jna/linux-ppc/libjnidispa tch.so; processor=ppc;osname=linux, com/sun/jna/linux-ppc64/libjnidis patch.so; processor=ppc64;osname=linux, com/sun/jna/linux-i386/libjni dispatch.so; processor=x86;osname=linux, com/sun/jna/linux-amd64/libj nidispatch.so; processor=x86-64;osname=linux, com/sun/jna/linux-arm/l ibjnidispatch.so; processor=arm;osname=linux, com/sun/jna/linux-ia64/ libjnidispatch.so; processor=ia64;osname=linux, com/sun/jna/openbsd- i386/libjnidispatch.so; processor=x86;osname=openbsd, com/sun/jna/fre ebsd-i386/libjnidispatch.so; processor=x86;osname=freebsd, com/sun/jn a/freebsd-amd64/libjnidispatch.so; processor=x86-64;osname=freebsd,
com/sun/jna/darwin/libjnidispatch.jnilib; osname=macos,

The blank line between the Main-Class: header and the Name: header needs to be removed.


Reply to this email directly or view it on GitHub: https://github.com/twall/jna/issues/63

pkriens commented 12 years ago

Name is the only invalid header for the main section ... A Name header indicates headers for the signing of Jars. These are the kind of errors (and many others) that bnd will catch.