Four cross-platform bindings of SWT

Source: Internet
Author: User

1. It is too dead to bind with JVM bit-version.
SWT bit versions include 32-bit and 64-bit. Likewise, jdk also supports 32-bit and 64-bit. After multiple tests, we found that 32-bit SWT can only be installed on 32-bit JDK, while 64-bit SWT can only be installed on 64-bit JDK, that is, 32-bit SWT cannot be used on 64-bit JDK, and 64-bit SWT cannot be used on 32-bit JDK, in both cases, an error similar to "version incompatibility" is reported. This may not be a big problem, but it will also consume your daily usage. I also mentioned this issue in two other articles.

Installanywhere: When a 64-bit swt encounters a 32-bit JVM

Handle the correspondence between the SWT bit version and the JDK bit version

2. binding to the operating system is too dead.
SWT calls the underlying system through C language to achieve its interface effect. In this way, corresponding to different operating systems, there are different SWT packages, the Eclipse official website also gives these packages and the corresponding operating system, such as eclipse3.7: http://download.eclipse.org/eclipse/downloads/drops/R-3.7.2-201202080800/index.php#SWT

But in fact, you will find that this cross-platform feature is actually not so powerful, especially for the Linux platform. You will find that a SWT package indicates that it can run on the Linux platform, but the Linux platform supports many platforms, such as Suse, RedHat, Ubuntu, Centos, and the same SWT package, on these platforms, the running effect may be different, and some packages cannot be compatible with the platform. Let alone SWT, that is, Eclipse will also have this problem. For example, during the test, I found that Eclise3.5 Linux cannot be installed on the Redhat6 server version, but Eclise3.6 can be used. It is okay when 3.5 is installed, that is, it cannot be remotely run during running, no errors or logs are reported. However, both 3.5 and 3.6 can be installed on Ubuntu.


3. Binding to a browser is too dead.
SWT contains a component Browser that can call the Browser installed by the system to display HTML files or open URL links. Check the source code of the component and you will find that the implementation process of the component has made many similar judgments on the browser to be called. My personal feeling is that these judgments are HardCode, and fault tolerance processing is not comprehensive, troubleshooting is inconvenient. It is good on the Windows platform, but the problem arises when switching to the Linux platform, especially to support multiple Linux platforms. For example:

[Java]
Exception in thread "main" org. eclipse. swt. SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
At org. eclipse. swt. SWT. error (SWT. java: 4308)
At org. eclipse. swt. browsers. Mozilla. initMozilla (Mozilla. java: 1826)
At org. eclipse. swt. browser. Mozilla. create (Mozilla. java: 687)
At org. eclipse. swt. browser. <init> (Browser. java: 99)
[Java]

[Java]
Exception 2: after update xulrunner
[Java]
Org. eclipse. swt. SWTError: XPCOM error-2147467259
 
At org. eclipse. swt. browser. Mozilla. error (Mozilla. java: 2089)
 
At org. eclipse. swt. browser. Mozilla. create (Mozilla. java: 458)
 
At org. eclipse. swt. browser. <init> (Browser. java: 119)
 
At com. ibm. team. apt. internal. ide. ui. editor. WikiFormPage2.createBrowser (WikiFormPage2.java: 816)
 

Although the Eclipse website provides FAQs, you will find that these are not enough. SWTFAQ

Browser problems can easily lead you to new technologies, such as xulrunner. I have not found a new solution to replace the Browser component. This Browser is really bad. Www.2cto.com

 

4. Implementation varies with different platforms. This is not listed. in the implementation process, we will find some differences in comparison.

 

The above are some of the problems I encountered when using SWT. If you have any errors, please correct them. I think we should be careful when using SWT to develop cross-platform products.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.