title: Eclipse Plugin, SWT "Unresolved requirement: Require-Capability"
body: <p>I'm stuck. I am unable to figure out what is causing me to receive "Unresolved requirement: Require-Capability" errors for an SWT bundle (and others, if I dig deeper). The requirements stated for it are win32 os and ws, and arch of x86_64, all of which seem like they should be satisfied by my system. I have included details below, and will update with details that anyone requests.</p>
  
  <p><strong>Background and Problem Details</strong></p>
  
  <p>I'm working on an Eclipse plugin project that hasn't been exported in a long time. It was upgraded from Java 7 to 8, and from Juno to Mars, since the last release. Last week, I went to make a new release, by using the 'Eclipse Product export wizard' in the .product file. Previous releases were fine. Launching the project from within Eclipse works fine (using the product file context menu Run As->Eclipse application to create the Launch configuration). Using the Validate Plug-ins functionality, seen in both the .product and launch config, shows no problems.</p>
  
  <p>The <strong>log shows</strong> the following:</p>
  
  <pre><code>!SESSION 2016-08-05 09:50:28.847 -----------------------------------------------
  eclipse.buildId=unknown
  java.version=1.8.0_101
  java.vendor=Oracle Corporation
  BootLoader constants: OS=${target.os}, ARCH=${target.arch}, WS=${target.ws}, NL=en_US
  Framework arguments:  -enableassertions
  Command-line arguments:  -os ${target.os} -ws ${target.ws} -arch ${target.arch} -clean -consoleLog -enableassertions -console
  
  !ENTRY org.eclipse.osgi 4 0 2016-08-05 09:50:30.975
  !MESSAGE An error occurred while automatically activating bundle org.eclipse.ui.workbench (96).
  !STACK 0
  org.osgi.framework.BundleException: Error starting module.
  at org.eclipse.osgi.container.Module.doStart(Module.java:580)
  ...
  Caused by: java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
      at java.lang.Class.getConstructor0(Unknown Source)
      at java.lang.Class.newInstance(Unknown Source)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
      at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
      at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
      at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
      at org.eclipse.osgi.container.Module.doStart(Module.java:571)
      ... 42 more
  Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError cannot be found by org.eclipse.ui.workbench_3.107.0.v20150825-2206
      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
      at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      ... 51 more
  Root exception:
  java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
  ...
  
  !ENTRY org.eclipse.osgi 4 0 2016-08-05 09:50:30.988
  !MESSAGE An error occurred while automatically activating bundle ca.uvic.chisel.atlantis (2).
  !STACK 0
  org.osgi.framework.BundleException: Error loading bundle activator.
      at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:711)
  etc etc...
  </code></pre>
  
  <p>I have access to the <strong>osgi console</strong>, and gotten some more information:</p>
  
  <pre><code>osgi&gt; ss org.eclipse.swt
  "Framework is launched."
  
  
  id      State       Bundle
  82      RESOLVED    org.eclipse.swt_3.104.1.v20150825-0743
  113     INSTALLED   org.eclipse.swt.win32.win32.x86_64_3.104.1.v20150825-0743
  osgi&gt; diag 113
  org.eclipse.swt.win32.win32.x86_64 [113]
    Unresolved requirement: Require-Capability: eclipse.platform; filter:="(&amp; (osg
  i.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))"
  </code></pre>
  
  <p>```</p>
  
  <p>Some more details on SWT on my system...the exported application has "/plugins/org.eclipse.swt.win32.win32.x86_64_3.104.1.v20150825-0743.jar", which is the same version specified by the org.eclipse.swt.win32.win32.x86_64 entry in the .product file's "Plug-ins and Fragments" config. (There is also org.eclipse.swt_3.104.1.v20150825-0743.jar and matching org.eclipse.swt). The bundle fragment requirements are as noted in the osgi console results, namely "(&amp; (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))".</p>
  
  <p>In the previous (functioning) release from my archives, I see it has org.eclipse.swt.win32.win32.x86_64_3.100.1.v4234e.jar. I do not know if the bundle fragment requirements were the same or different back then. I do not have access to the osgi console in this release, because I did not include the necessary libraries for it back then.</p>
  
  <p>Looking at other bundles, I saw some that are not RESOLVED status either.</p>
  
  <p><strong>Development Context</strong></p>
  
  <p>I am developing, exporting, and running the project on Windows 7. My JRE System Library for dev is jre1.8.0_101-b13. This is the same version (same file path) as the JRE installed for running Java applications.</p>
  
  <pre><code>C:\Atlantis Export\Atlantis 0.3.0 TEST 3&gt;java -XshowSettings:properties -version
  Property settings:
      awt.toolkit = sun.awt.windows.WToolkit
      file.encoding = Cp1252
      file.encoding.pkg = sun.io
      file.separator = \
      java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
      java.awt.printerjob = sun.awt.windows.WPrinterJob
      java.class.path = .
      java.class.version = 52.0
      java.endorsed.dirs = C:\Program Files\Java\jre1.8.0_101\lib\endorsed
      java.ext.dirs = C:\Program Files\Java\jre1.8.0_101\lib\ext
          C:\Windows\Sun\Java\lib\ext
      java.home = C:\Program Files\Java\jre1.8.0_101
      java.io.tmpdir = C:\Users\eric\AppData\Local\Temp\
      java.library.path = C:\ProgramData\Oracle\Java\javapath
          C:\Windows\Sun\Java\bin
          C:\Windows\system32
          C:\Windows
          C:\ProgramData\Oracle\Java\javapath
          C:\Windows\system32
          C:\Windows
          C:\Windows\System32\Wbem
          C:\Windows\System32\WindowsPowerShell\v1.0\
          C:\Program Files (x86)\pgmodeler
          C:\WinPython-64bit-3.4.3.5\python-3.4.3.amd64
          %USERPROFILE%\.dnx\bin
          C:\Program Files\Microsoft DNX\Dnvm\
          C:\Program Files\nodejs\
          C:\Program Files (x86)\Skype\Phone\
          C:\Windows\System32\WindowsPowerShell\v1.0\
          C:\Program Files\010 Editor
          C:\Users\eric\AppData\Roaming\npm
          .
      java.runtime.name = Java(TM) SE Runtime Environment
      java.runtime.version = 1.8.0_101-b13
      java.specification.name = Java Platform API Specification
      java.specification.vendor = Oracle Corporation
      java.specification.version = 1.8
      java.vendor = Oracle Corporation
      java.vendor.url = http://java.oracle.com/
      java.vendor.url.bug = http://bugreport.sun.com/bugreport/
      java.version = 1.8.0_101
      java.vm.info = mixed mode
      java.vm.name = Java HotSpot(TM) 64-Bit Server VM
      java.vm.specification.name = Java Virtual Machine Specification
      java.vm.specification.vendor = Oracle Corporation
      java.vm.specification.version = 1.8
      java.vm.vendor = Oracle Corporation
      java.vm.version = 25.101-b13
      line.separator = \r \n
      os.arch = amd64
      os.name = Windows 7
      os.version = 6.1
      path.separator = ;
      sun.arch.data.model = 64
      sun.boot.class.path = C:\Program Files\Java\jre1.8.0_101\lib\resources.jar
          C:\Program Files\Java\jre1.8.0_101\lib\rt.jar
          C:\Program Files\Java\jre1.8.0_101\lib\sunrsasign.jar
          C:\Program Files\Java\jre1.8.0_101\lib\jsse.jar
          C:\Program Files\Java\jre1.8.0_101\lib\jce.jar
          C:\Program Files\Java\jre1.8.0_101\lib\charsets.jar
          C:\Program Files\Java\jre1.8.0_101\lib\jfr.jar
          C:\Program Files\Java\jre1.8.0_101\classes
      sun.boot.library.path = C:\Program Files\Java\jre1.8.0_101\bin
      sun.cpu.endian = little
      sun.cpu.isalist = amd64
      sun.desktop = windows
      sun.io.unicode.encoding = UnicodeLittle
      sun.java.launcher = SUN_STANDARD
      sun.jnu.encoding = Cp1252
      sun.management.compiler = HotSpot 64-Bit Tiered Compilers
      sun.os.patch.level = Service Pack 1
      sun.stderr.encoding = cp437
      sun.stdout.encoding = cp437
      user.country = US
      user.dir = C:\Atlantis Export\Atlantis 0.3.0 TEST 3
      user.home = C:\Users\eric
      user.language = en
      user.name = eric
      user.script =
      user.timezone =
      user.variant =
  
  java version "1.8.0_101"
  Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
  </code></pre>
  
  <p>I have tried upgrading again from Mars, to Neon. That didn't resolve anything. Downgrading to Juno to fix something like this smells like the wrong solution.</p>