0

I'm currently working on a java project in eclipse that uses 64-bit SWT libraries. A lot of the computers this program might be used on have 32 bit operating systems, so to avoid making a 32-bit and a 64-bit version, I want to explore dynamically loading a 32-bit or 64-bit SWT library depending on the JRE being used at the time.

I found some references to using ClassLoader, ServiceLoader, and similar objects, however I'm not sure how that would fit in with eclipse's structure, and if eclipse's structure even allows for this type of loading in the first place. Additionally, I am unsure how to check which jvm is being used inside the code, which I assume would be a prerequisite for knowing which SWT libraries would load correctly.

If you guys would be able to provide any suggestions or directions in which to focus my research, that would be great. I'm currently pretty unsure on how to proceed.

Thanks!

user3886403
  • 133
  • 1
  • 6
  • Is this an RCP app, or just a "plain" Java app that happens to use SWT? – E-Riz Jul 29 '14 at 19:00
  • Any reason you can't just use 32-bit SWT only? I'm not sure what real benefit 64-bit has for SWT. – E-Riz Jul 29 '14 at 19:01
  • It's some control code that just uses SWT. The first 5 versions were 32-bit, then this version was 64-bit. The project was passed on to me recently, so I've been trying to be as non-invasive as possible so to speak, but I'm not sure what the justification was for switching to 64-bit. – user3886403 Jul 29 '14 at 19:03

1 Answers1

0

This SO question has some answers with code that you could pilfer and adjust to your needs. By the way, Eclipse itself (actually, the OSGi runtime) could handle this for you, if you were doing an RCP app.

Community
  • 1
  • 1
E-Riz
  • 31,431
  • 9
  • 97
  • 134