1. 程式人生 > >Eclipse 3.7 3.x SWT/Jface 開發環境搭建

Eclipse 3.7 3.x SWT/Jface 開發環境搭建

1、準備工作

1.1、下載eclipse

目前的版本是eclipse-jee-indigo-SR1-win32

解壓到d:\java\ide\eclipse-jee-indigo-SR1-win32

1.2、下載swt

下載win32版本,結果是個zip檔案

2、匯入org.eclipse.swt 專案

執行eclipse,選單中點選

file -> import -> general-exsiting projects to workspace -> next -> select archive file -> 選取下載的文——點選browse,會出現專案org.eclipse.swt->next

匯入成功

3、新建SWT專案

file -> new -> javaproject ...

右鍵點選專案properties -> java build path -> projects -> 點add,把org.eclipse.swt專案加進來

OK,可以寫SWT程式了

4、加入Jface支援

同3

properties -> java build path ->Libraries-> add external JARs..或Add Library

加入以下jar包:(jar包在eclipse安裝目錄的plugins子目錄中找)

org.eclipse.core.commands_xxx.jar

org.eclipse.core.runtime_xxx.jar

org.eclipse.equinox.common_xxx.jar //一定要加,不然會報java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor

org.eclipse.jface_xxx.jar

org.eclipse.jface.text_xxx.jar

org.eclipse.osgi_xxx.jar

為解決jface的中文問題,還要加上

org.eclipse.jface.nl1_3xx.jar

OK