Read Sean

          Read me, read Sean.
          posts - 508, comments - 655, trackbacks - 9, articles - 4

          和Swing應用的直接跨平臺不同,SWT/RCP應用要想同時支持不同平臺,需要做些特殊的配置,不過并不復雜,記錄在此,希望能幫到有需要的朋友。目前win32、32位Linux、64位Linux和Mac OS X基本上就覆蓋了所有主流的桌面操作系統,本文將以同時支持這四種OS為例來進行講解。

          首先是下載對應版本的RCP框架在不同操作系統的插件,將它們放在同一個plugins目錄,比如你可以用win32為基礎,然后添加針對其他平臺的如下插件:

          org.eclipse.core.filesystem
          org.eclipse.core.filesystem.win32.x86
          org.eclipse.core.filesystem.linux.x86
          org.eclipse.core.filesystem.linux.x86_64
          org.eclipse.core.filesystem.macosx

          org.eclipse.core.net
          org.eclipse.core.net.win32.x86
          org.eclipse.core.net.linux.x86

          org.eclipse.core.resources
          org.eclipse.core.resources.win32.x86

          org.eclipse.equinox.launcher
          org.eclipse.equinox.launcher.win32.win32.x86
          org.eclipse.equinox.launcher.gtk.linux.x86
          org.eclipse.equinox.launcher.gtk.linux.x86_64
          org.eclipse.equinox.launcher.carbon.macosx

          org.eclipse.equinox.security
          org.eclipse.equinox.security.win32.x86
          org.eclipse.equinox.security.macosx

          org.eclipse.swt
          org.eclipse.swt.win32.win32.x86
          org.eclipse.swt.gtk.linux.x86
          org.eclipse.swt.gtk.linux.x86_64
          org.eclipse.swt.carbon.macosx

          接下來將不同平臺下的eclipse可執行文件(Windows下面是eclipe.exe,Linux下是eclipse,Mac OS X下面是Eclipse.app)放到不同的子目錄下,當然,如果你的RCP應用有別的名稱,也可以重命名eclipse可執行文件,按照不同平臺的規范更換圖標,然后修改.ini文件讓它的-startup和-startup.libraray參數指向相對路徑中正確版本的插件即可。

          最后分享一下我們軟件部署的機制: 按照前面介紹的方式打包的應用程序,交到用戶手里并不是很友好,因為需要他/她自己再做一次判斷,當前的操作系統是什么,然后打開不同的目錄去點擊不同的可執行文件。我們的做法是單獨提供一個Swing程序,在客戶端自動判斷OS,然后自動調用不同版本的可執行文件,同時,這個Swing程序被做成Java Web Start,把整個RCP客戶端的下載和同步也處理掉,這樣,對用戶而言,整個過程就透明了,只需要一個JNLP,剩下的工作完全自動化。

          主站蜘蛛池模板: 中山市| 来安县| 香港| 陈巴尔虎旗| 西乡县| 新郑市| 盘山县| 湖北省| 深圳市| 桦甸市| 湘潭市| 白玉县| 察哈| 沙河市| 祁门县| 潞西市| 金秀| 廊坊市| 台湾省| 尖扎县| 华宁县| 富平县| 绥芬河市| 望都县| 临猗县| 双桥区| 确山县| 朝阳市| 织金县| 凤阳县| 永川市| 二手房| 永清县| 佛坪县| 衢州市| 台东县| 永吉县| 平阳县| 来凤县| 江华| 新郑市|