Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 281075

Summary: Bundle-NativeCode can't work on Windows Server 2008/Windows 7
Product: [Eclipse Project] Equinox Reporter: Meng Xin Zhu <zhumx>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: haoxy, hargrave, kane.mx, raji, roba, swtnov, tjwatson
Version: 3.4.2Flags: hargrave: review+
Target Milestone: 3.5.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
osname alias patch
none
11 none

Description Meng Xin Zhu CLA 2009-06-22 09:26:00 EDT
Build ID: 3.4.2

Steps To Reproduce:
1.add 'Bundle-NativeCode' header in MANIFEST.MF, and using 'win32' to match all windows platform
2.Bundle class loader can't find the according library when calling System.loadLibrary on Windows Server 2008/Windows 7



More information:
Why not Equinox simply match all OS to alias 'win32' whose name starts with 'Windows'
Comment 1 BJ Hargrave CLA 2009-06-22 10:07:45 EDT
(In reply to comment #0)
> Why not Equinox simply match all OS to alias 'win32' whose name starts with
> 'Windows'

What about Windows CE then? It seems a very bad idea to assume that all OS names which start with Windows are win32 api compatible. 

Comment 2 Thomas Watson CLA 2009-06-22 10:26:05 EDT
(In reply to comment #1)
> What about Windows CE then? It seems a very bad idea to assume that all OS
> names which start with Windows are win32 api compatible. 
> 

I agree with BJ.  On Windows Server 2008/Windows 7 can you tell us what the os.name java property is?  Can you start Eclipse in Windows 7?  If so then open the about dialog and get the configuration information.  On 3.5 you can bring this up by going to Help > About Eclipse SDK and clicking the "Installation Detais" and going to the "Configuration" tab.

We currently have the os.name aliases hard coded in the framework.  We should consider an option to pass in an external alias table to allow new OS'es to be configured in.

As a work around you can specify multiple osname attributes on your Bundle-NativeCode clause to include "Windows 7" (depending on what the os.name system property is).
Comment 3 Thomas Watson CLA 2009-06-22 10:40:41 EDT
We should consider updating the built in os name alias table for 3.5.1.
Comment 4 Meng Xin Zhu CLA 2009-06-22 21:59:08 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > What about Windows CE then? It seems a very bad idea to assume that all OS
> > names which start with Windows are win32 api compatible. 
> > 
> 
> I agree with BJ.  On Windows Server 2008/Windows 7 can you tell us what the
> os.name java property is?  Can you start Eclipse in Windows 7?  If so then open
> the about dialog and get the configuration information.  On 3.5 you can bring
> this up by going to Help > About Eclipse SDK and clicking the "Installation
> Detais" and going to the "Configuration" tab.
> 

I just tried to get the os.name java property on Windows Server 2008. The value
of os.name java property is 'Windows Server 2008'.
> We currently have the os.name aliases hard coded in the framework.  We should
> consider an option to pass in an external alias table to allow new OS'es to be
> configured in.
> 
> As a work around you can specify multiple osname attributes on your
> Bundle-NativeCode clause to include "Windows 7" (depending on what the os.name
> system property is).
> 
Do you mean that I can use below way as a work around without adding 'Windows
Server 2008' into osname.aliases file,
Bundle-NativeCode: /lib/win32/officebean.dll; osname=win32; processor=x86,
             /lib/win32/officebean.dll; osname=Windows Server 2008;
processor=x86, *
Comment 5 Thomas Watson CLA 2009-06-23 09:25:47 EDT
(In reply to comment #4)
> Do you mean that I can use below way as a work around without adding 'Windows
> Server 2008' into osname.aliases file,
> Bundle-NativeCode: /lib/win32/officebean.dll; osname=win32; processor=x86,
>              /lib/win32/officebean.dll; osname=Windows Server 2008;
> processor=x86, *
> 

You should quote the value with spaces.  You can also specify the osname multiple times for the same native code element:

Bundle-NativeCode: /lib/win32/officebean.dll;
 osname=win32;
 osname="Windows Server 2008";
 processor=x86,
 *

This means the path /lib/win32/officebean.dll can work on win32 and Windows Server 2008 OS's.
Comment 6 Meng Xin Zhu CLA 2009-06-24 04:52:58 EDT
(In reply to comment #5)
> You should quote the value with spaces.  You can also specify the osname
> multiple times for the same native code element:
> 
> Bundle-NativeCode: /lib/win32/officebean.dll;
>  osname=win32;
>  osname="Windows Server 2008";
>  processor=x86,
>  *
> 
> This means the path /lib/win32/officebean.dll can work on win32 and Windows
> Server 2008 OS's.
> 
Got it. 
BTW: It seems that quoting the value with spaces is not necessary. The library is successfully load by defining like below,
Bundle-NativeCode: /lib/win32/officebean.dll;
  osname=win32;
  osname=windows server 2008;
  processor=x86,
  *
Comment 7 Thomas Watson CLA 2009-06-24 09:06:28 EDT
(In reply to comment #6)
> Got it. 
> BTW: It seems that quoting the value with spaces is not necessary. The library
> is successfully load by defining like below,
> Bundle-NativeCode: /lib/win32/officebean.dll;
>   osname=win32;
>   osname=windows server 2008;
>   processor=x86,
>   *
> 

The Equinox manifest parser is a bit forgiving when it comes to strict header syntax.  But according to the specification attribute values containing quotes should be quoted.
Comment 8 Thomas Watson CLA 2009-06-24 09:08:01 EDT
(In reply to comment #7)
> But according to the specification attribute values containing quotes
> should be quoted.
> 

I meant to type:

But according to the specification attribute values containing SPACES should be quoted.
Comment 9 Thomas Watson CLA 2009-07-28 15:10:44 EDT
Meng, what build of Windows 7 did you use?  What VM and version did you use.  I am in the process of getting a machine setup with Windows7.  I somehow doubt the os.name will remain Windows Server 2008 for the final release of Windows 7.  I am thinking we will need an alias list like this for Windows7:

Windows7 "Windows Server 2008" "Windows 7" Win32
Comment 10 Meng Xin Zhu CLA 2009-07-29 00:57:52 EDT
(In reply to comment #9)
> Meng, what build of Windows 7 did you use?  What VM and version did you use.  I
> am in the process of getting a machine setup with Windows7.  I somehow doubt
> the os.name will remain Windows Server 2008 for the final release of Windows 7.
>  I am thinking we will need an alias list like this for Windows7:
I never have Windows 7. I just guessed there is same problem on Windows 7 via reading the source code(osname.alias).
> Windows7 "Windows Server 2008" "Windows 7" Win32
I tried to search the os.name of Windows 7 in google, the value seems to be "Windows 7". It should not remain using "Windows Server 2008" as its name.

Comment 11 Thomas Watson CLA 2009-07-30 16:03:46 EDT
Created attachment 143081 [details]
osname alias patch

We need to support both Windows Server 2008 and Windows 7.  Here is a patch that adds aliases for both.
Comment 12 Thomas Watson CLA 2009-07-30 16:04:45 EDT
I released the patch to HEAD.  Still need to do some testing on Windows 7 and Windows Server 2008.
Comment 13 Thomas Watson CLA 2009-07-30 17:30:23 EDT
I just tried this on Windows 7:
- IBM 1.6 VM and the VM reports os.name as "Windows Vista".
- Sun 1.6.0 update 14 reports os.name as "Windows 7"

I think the IBM VM currently has a bug reporting os.name as Windows Vista.
Comment 14 Thomas Watson CLA 2009-08-05 17:29:25 EDT
BJ can you review the new aliases for 3.5.1.  Note that I already opened an OSGi bug to get these aliases added to the spec reference page.
Comment 15 BJ Hargrave CLA 2009-08-05 21:59:50 EDT
I did note there is no "Win7" short alias like the other Windows variants.
Comment 16 Thomas Watson CLA 2009-08-06 12:23:34 EDT
(In reply to comment #15)
> I did note there is no "Win7" short alias like the other Windows variants.
> 

I had noticed this before and fixed in in HEAD already, I forgot to attach a new patch here.  I released the new osname.aliases with "Win7" included to 3.5.1.
Comment 17 hj0424.bae CLA 2010-12-23 02:03:36 EST
Created attachment 185748 [details]
11
Comment 18 Rob A. CLA 2011-01-13 12:29:10 EST
This is still an issue with Windows Server 2008 R2.  The jave os.name returns "Windows Server 2008 R2" on and R2 system.

The osname.aliases file needs to have the following line added to it

Windows2008R2 "Windows 2008 R2" "Windows Server 2008 R2" Win2008R2 Win32 # Microsoft

Can someone reopen this bug or should a new bug be created?
Comment 19 Thomas Watson CLA 2011-01-14 16:19:00 EST
please open a new bug.
Comment 20 Rocky CLA 2011-01-17 19:43:36 EST
Hi Thomas,
I had same issue with Windows Server 2008 R2. I am kind of in urgent to solve this issue. Is there a workaround before this bug is opened and fixed?

Thanks,

Rocky
(In reply to comment #19)
> please open a new bug.
Comment 21 J.-P. Pellet CLA 2011-01-24 09:19:37 EST
Rocky,

There is a workaround: just add

  osname="windows server 2008 r2";

after

  osname=win32;

in your Bundle-NativeCode entry.
Comment 22 J.-P. Pellet CLA 2011-01-24 09:31:32 EST
New bug opened for the R2 problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=335191