Presentation is loading. Please wait.

Presentation is loading. Please wait.

交通大學資訊工程學系 1 How To Java? 使用 JDK –Microsoft Windows –FreeBSD / Linux 使用 Java IDE ( 注意 ! 很多仍需 JDK 配合 ) –VisualAge for Java (IBM) (Eclipse 前身 ) –Eclipse.

Similar presentations


Presentation on theme: "交通大學資訊工程學系 1 How To Java? 使用 JDK –Microsoft Windows –FreeBSD / Linux 使用 Java IDE ( 注意 ! 很多仍需 JDK 配合 ) –VisualAge for Java (IBM) (Eclipse 前身 ) –Eclipse."— Presentation transcript:

1 交通大學資訊工程學系 1 How To Java? 使用 JDK –Microsoft Windows –FreeBSD / Linux 使用 Java IDE ( 注意 ! 很多仍需 JDK 配合 ) –VisualAge for Java (IBM) (Eclipse 前身 ) –Eclipse ( 蝕 ; 蓋過 ) –IntelliJ IDEA (JetBrains) –JBuilder (Borland/Codegear) –JDeveloper (Oracle ; technet.oracle.com) (JDeveloper 是 JBuilder 補充改寫的 ) –JCreator, Forte for Java, Sun Java Studio, Sun NetBeans, … –Visual J++ (Microsoft), Visual J# (J Sharp), Visual Studio –Visual Café (WebGain, Symantec+BEA; closed at 2002)

2 交通大學資訊工程學系 2 Write Java program , you need … 1. 用編輯器 (editor) 寫 Java 程式 2. 用編譯器 (compiler) 把 Java 程式轉成 Java bytecode ,也就是 class 檔 3. 用解譯器 ( Interpreter ) 來執行 Java 的 class 檔 4. 用除錯器 (debugger) 來協助找出程式的問題 Sun 提供一套 Java 程式發展工具集,稱為 JDK (Java Development Kit) ,具有 2,3,4 的功能。 同時具有上述 4 項功能者,稱為整合發展環境 (IDE, Integrated Development Environment)

3 交通大學資訊工程學系 3 Download and install JDK http://java.sun.com Download the standard version(J2SDK/Java SDK) Simply double click and then follow the instructions Configure / prepare your Develop Environment –Set correct command PATH before starting –Batch file / Short cut / Edit System environment variable Download Java Documentation/Reference manual Java is good for GUI + Event driven programming GUI, Graphical User Interface –A way for the computer and the user to communicate via graphics (pictures) on the screen

4 交通大學資訊工程學系 4 JDK Installed Directory Tree The JDK has the directory structure shown below. jdk_ _______________________|______________________ | | | | | | | | | | | | | bin lib | demo | | | | LICENSE | | | jre | | COPYRIGHT… … | __|__ | README.txt include | | readme.html bin lib Sun 把 JDK 1.5 改名 5.0; 所以 JDK 1.6.1 就是 JDK 6.1

5 交通大學資訊工程學系 5 JDK 的基本組成份子 /binJava binary programs /docsJava documents /jre/binRun-time 用的 binary programs /jre/lib 或 /lib Run-time library 重要的是 /jre/lib/rt.jar 這個檔案 早期版本是 /lib/classes.zip

6 交通大學資訊工程學系 6 JDK Versions ( 版本 ) Java 1.1 –jdk 1.1.8_16 and older versions Java 2 ( 別搞混 Language version 與 JDK version) –Standard Edition (J2SE) j2sdk 1.2 ( 主要加入 Swing ) j2sdk 1.3.1_14 j2sdk 1.4.2_06 j2sdk 1.5.xx (5.0); 1.6 (6.0), 1.7(7.0), … –Enterprise Edition (J2EE) –Micro Edition (J2ME) Sun 自 JDK1.6 (6.0) 開始已改稱 Java 不再稱 Java 2 JDK 1.5 (5.0) 開始有支援 Generic type ( 即 template)

7 交通大學資訊工程學系 7 JDK vs. JRE JRE (Java Runtime Environment) – 用來執行 Java 程式 JDK (Java Development Kit) – 用來開發、測試或執行 Java 程式 – 已經包含 JRE 了 使用 JDK 開發程式,就得有相對應版本的 JRE 來執行。 – 使用 j2sdk 1.5 開發,那必須要有 jre 1.5 以上版本才 能執行。 (JDK 版本 1.5 就是 5.0)

8 交通大學資訊工程學系 8 Types of Java programs Java Application –Standalone program Java Applet – 搭配 HTML 網頁 Java Servlet – 放在網站且直接會在網站上執行 JSP -- Java Server Page ( 類似 ASP, PHP) –HTML 網頁內夾著片片段段的 Java 程式 Java MIDLet -- 在手機或手持裝置 Java ???Let

9 交通大學資訊工程學系 9 CLASSPATH 說明 使用 java, javac 等工具時,如果沒有指定 classpath 的話,會自動使用環境變數 CLASSPATH 所指定的路徑。 CLASSPATH 中可以指定目錄、 zip 檔、 jar 檔,用分號隔開,例:. ;C:\MyLIB;C:\JDK\jre\lib\rt.jar 用點. 表示目前所在目錄

10 交通大學資訊工程學系 10 Microsoft Windows 2000/XP/… 1. 先到 Sun 的網站去抓 JDK ,如 : http://java.sun.com 2. 假設把 JDK 安裝在 C:\JDK 3. 控制台 > 系統 > 進階 > 環境變數 4. 找到變數 PATH ,加入 C:\JDK\bin 找到變數 CLASSPATH ,加入. ;C:\JDK\jre\lib\rt.jar

11 交通大學資訊工程學系 11 Win2000 設定 用滑鼠右鍵按 住 " 我的電腦 " 選內容

12 交通大學資訊工程學系 12 Win2000 設定 WinXP 在下一頁

13 交通大學資訊工程學系 13 Windows XP 用滑鼠右鍵按 住 “ 我的電腦 ” 選內容 再按環境變數

14 交通大學資訊工程學系 14 Win2000 WinXP 設定 編輯 Path

15 交通大學資訊工程學系 15 Win2000 WinXP 設定 編輯 CLASSPATH 注意全大寫

16 交通大學資訊工程學系 16 JDK 中的 Tools 這些 tools 都擺在 JDK 的 \bin 裡面: javac.exe : Java compiler ( 編譯器 ) java.exe : Java interpreter ( 解譯器 ) appletviewer : Java applet viewer javap : Class file disassembler ( 反組譯 )

17 交通大學資訊工程學系 17 Java Application 編譯:  javac MyTest.java 執行:  java MyTest 反組譯:  javap MyTest 注意執行與反組譯都不要打.class 因為那是 class 名稱不 是檔案名稱 !

18 交通大學資訊工程學系 18 Java Applet 編譯:  javac MyApplet.java 執行:  Win XP 後直接打 MyPage.htm  appletviewer MyPage.htm  放網站後用瀏覽器看 MyPage.htm <applet code=MyApplet.class name=MyApplet width=320 height=200>

19 交通大學資訊工程學系 19 編碼 (Encoding) 的問題 如果程式印出亂碼,那可能是編譯時, 沒有指定正確的內部編碼,試試這個: –javac -encoding BIG5 MyTest.java 常用 encoding –BIG5 –MS950 –UNICODE –UTF8

20 交通大學資訊工程學系 20 如何知道系統預設編碼? // FileEncoding.java -- find the default encoding public class FileEncoding { public static void main(String[] args) { System.out.println(System.getProperty(" file.encoding ")); } D:\jtest> javac FileEncoding.java D:\jtest> java FileEncoding

21 交通大學資訊工程學系 21 可以搜尋的 Java document http://www.allimant.org/javadoc/javadoce.html

22 交通大學資訊工程學系 22 有很多檔案要編譯時 使用 makefile (example in next slide) –Makefile 是一個文字檔, 描述執行檔要由哪些機器碼 檔 (object file) 組成, 各 object file 與那些原始檔 (source file) 和標題檔 (header file) 有關, 以及要使用什 麼命令產生 object file 使用 Ant (用 google.com 找找) –http://ant.apache.org – 以前是 Apache 的 Jakarta 計畫下的子計畫 –Apache 軟體基金會 (ASF) 正式成立於 1999 年 (see wikipedia) 使用 IDE 來開發 (with project 專案 ) – 有些 IDE 有提供 PRJ2MAK 工具可以把 project 檔案轉換成 makefile

23 交通大學資訊工程學系 23 Unix 下的 makefile 範例.SUFFIXES:.class.java JAVAC=/usr/local/jdk1.4.1/bin/javac -encoding Big5 -deprecation - classpath.:/usr/local/jdk1.4.1/jre/lib/rt.jar #JAVAC=/usr/local/jdk1.4.1/bin/javac -encoding Big5 -deprecation - classpath..:/usr/local/jdk1.4.1/jre/lib/rt.jar #JAVAC=/usr/local/jdk1.4.1/bin/javac -encoding Big5 -deprecation - classpath../..:/usr/local/jdk1.4.1/jre/lib/rt.jar all:FileEncoding.class cd test; make.java.class: $(JAVAC) $< clean: rm -f *.class chmod 644 *.java makefile

24 交通大學資訊工程學系 24 dosMake /make/nmake http://java.csie.nctu.edu.tw/~icwu/classes/java/doc/dosMake.zip 所有檔案拷貝到 JDK 安裝目錄的 bin 裡面,就可以共用 PATH 設定,使用 make 來編譯、執行程式 修改 make.bat set JAVASDK_HOME=C:\j2sdk1.4.2\bin set JAVAC=%JAVASDK_HOME%\javac.exe set JAVAC_OPTION=-classpath ".;%JAVASDK_HOME%\jre\lib\rt.jar" set JAVA=%JAVASDK_HOME%\java.exe set JAVA_OPTION=-classpath ".;%JAVASDK_HOME%\jre\lib\rt.jar" rem default make action, could be "new", "all", or "clean" set DEFAULT_ACTION=all rem default main class for executing. rem Leave it blank if you don't want to run your program after make. set DEFAULT_MAIN_CLASS=

25 交通大學資訊工程學系 25 Using IDEs An IDE is an Integrated Development Environment All professional IDEs are similar Different IDEs meet different needs –BlueJ, DrJava are designed as teaching tools Emphasis is on ease of use for beginners Little to learn, so students can concentrate on learning Java –Eclipse, JBuilder, NetBeans are designed as professional-level work tools Emphasis is on supporting professional programmers More to learn, but well worth it in the long run 想要節省時間, 必須先花一些時間好好學習使用工具

26 交通大學資訊工程學系 26 Java IDEs on Windows 1.Microsoft Visual J++ / Visual Studio 2.Borland(CodeGear) JBuilder: http://www.borland.com/products/downloads/download_jbuilder.html 3.Eclipse: http://www.eclipse.org/downloads/index.php 4.JetBrains IntelliJ IDEA:(30 天試用 ) http://www.jetbrains.com/idea/download/index.html Ps. 後三者均有 Unix 、 Mac 的對應版本

27 交通大學資訊工程學系 27 IDE Benefit 使用 IDE 環境,寫程式會更為方便,比起純粹使 用 JDK 來說,主要有下列優點: – 「寫程式、編譯、測試」一套軟體就可搞定 –Look for help: 快速 API 說明 –Check syntax: 自動文法檢查 –Reformat code: 自動排版, 程式結構井然一致 –Debug/test code: 容易除錯 –Generate code: 快速產生程式 –Navigate code: 快速瀏覽程式 –Refactor code: 快速重整程式

28 交通大學資訊工程學系 28 A good IDE should.. (1/2) Include a “Syntax aware” text editor –different tokens can be colored differently for catching runaway comments or strings, for example – brace{ }, bracket[ ], and parentheses ( ) matching whenever a closing brace, bracket or parenthesis is typed the editor shows you the corresponding opening brace, bracket, or parenthesis clicking on brace, bracket, or parenthesis will show the corresponding block

29 交通大學資訊工程學系 29 A good IDE should.. (2/2) Simplicity –powerful development environment, but the power is hidden –we do not use most of what is there Debugger is useful and generally intuitive –helpful to the students –useful for demonstrations Support for the standard libraries

30 交通大學資訊工程學系 30 Debug functions Break point :程式執行到中斷點時會暫停 Step :一行一行追蹤程式 Step into :遇到函式時,進去追蹤 Step over :遇到函式時,不進去追蹤 Watch :觀察變數值、修改變數值

31 交通大學資訊工程學系 Eclipse Reference: http://www.eclipse.org/eclipse/presentation/eclipse-slides.ppt Eclipse (1/58)

32 交通大學資訊工程學系 32 Solar Eclipse Eclipse (2/58)

33 交通大學資訊工程學系 33 Eclipse.org Eclipse 3.x 強悍的開放原始碼軟體( $0 ),可用來開發多 種語言的程式( Java, C/C++, … ) 需要另外安裝 JDK Pros( 優點 ) :多種程式語言開發環境 Cons( 缺點 ) :各類 Plugin 的安裝設定稍複雜 Eclipse 指蝕,如日蝕( solar eclipse )、月蝕 ( lunar eclipse ) Eclipse (3/58)

34 交通大學資訊工程學系 34 Eclipse 中文化 (1/2) 英文不是很爛的就不必中文化啦 ! 到 www.eclipse.org 下載後直接將檔案解壓縮至 C:\ 或其 他目錄,會自動產生 eclipse 的子目錄 到 www.eclipse.org 搜尋中文套件 Language Pack 。 下載最新的中文套件檔案 NLpack1 。 ( 網站內搜尋 ) –NLpack1-eclipse-SDK-3.2-win32.zip –Around 6.31 MB current version 將下載中文套件檔案解壓縮,可以得到 features 目錄和 plugins 目錄。將該兩個目錄複製到 eclipse 目錄下覆蓋原 有的子目錄。 重新開啟 Eclipse ,就成繁體中文版了。 Eclipse (4/58)

35 交通大學資訊工程學系 35 Eclipse 中文化 (2/2) 若要啟動不同環境,可在 DOS 介面下輸入: – 英文 eclipse.exe -nl "zh_US" – 繁體 eclipse.exe -nl "zh_TW" – 簡體 eclipse.exe -nl "zh_CN" 或是建立 eclipse 的捷徑後,複製多個捷徑並在它們內容的 捷徑項目中的目標位置,修改其啟動時的參數 : eclipse.exe -nl "zh_US" eclipse.exe -nl "zh_TW" eclipse.exe -nl "zh_CN" 35 Eclipse (5/58)

36 交通大學資訊工程學系 36 Eclipse Setup again 安裝外掛 Jigloo SWT/Swing GUI Builder for Eclipse – 讓 Eclipse 可以像 JBuilderX 一樣使用拖拉方式建構 GUI 的外掛 –http://cloudgarden.com/jigloo/index.html 36 Eclipse (6/58)

37 交通大學資訊工程學系 37 Eclipse Terminology Workbench 工作台 ; 工作桌面 ; 工作窗 – 可以打開多個工作窗 Window >> new Window – 工作窗中的各工作格可移動也可調整大小或關掉 – 每個工作格的右上角可點按縮小或放大 – 弄亂了可以點按 Window >> Reset Perspective 恢復 Workspace 工作目錄 ; 工作空間 – 可有多個工作目錄 Eclipse (7/58)

38 交通大學資訊工程學系 38 Eclipse Workbench ( 工作台 ) Represents the desktop development environment –It contains set of tools for resource management –It provides common way of navigating through the resources Multiple workbenches can be opened at the same time Eclipse (8/58)

39 交通大學資訊工程學系 39 Eclipse Workspace ( 工作空間 ) Represents users data It is a set of user defined resources –Files Contain arbitrary number of bytes –Folders Contain other folders or files –Projects Collections of files and folders Eclipse (9/58)

40 交通大學資訊工程學系 40 Download Eclipse http://www.eclipse.org Main point for finding Eclipse resources –Downloads –Articles –Discussion groups –Bugs report Contains various resources for using Eclipse Contains references to other Eclipse related sites Eclipse (10/58)

41 交通大學資訊工程學系 41 Running Different Workspace … It is possible to run different workspaces using command prompt –-data argument must be used with eclipse.exe –Workspace location must be specified Useful for grouping project specific data Multiple workspaces can run at the same time Eclipse (11/58)

42 交通大學資訊工程學系 42 … Running Different Workspace Customize your working directory by creating a shortcut identifying the eclipse.exe and the working directory Eclipse (12/58)

43 交通大學資訊工程學系 43 啟動 Eclipse 可點擊之前建好的捷徑, 也可在 cmd mode 直接下 eclipse 命令 或是寫一支 ggyy.bat ,啟動 Eclipse 時直接指定 JDK 的位置, ggyy.bat 檔案內容如下例 : ( 注意你的 VM) start eclipse -vm c:\jdk1.5.0_05\jre\bin\javaw -vmargs -Xmx256M 剛啟動就要設定 Project 的存放位置 Eclipse (13/58)

44 交通大學資訊工程學系 44 Workbench Terminology Tool bar Perspective and Fast View bar Resource Navigator view Stacked views Properties view Tasks view Outline view Bookmarks view Menu bar Message area Editor Status area Text editor Eclipse (14/58)

45 交通大學資訊工程學系 45 Workbench again Menu bar Tool bar Text editor Outline view Running Result Eclipse (15/58)

46 交通大學資訊工程學系 46 Workspace 工作目錄 You can have multiple workspace (working directory) Specify your workspace when starting Eclipse You can also switch workspace in Eclipse: File >> Switch Workspace Eclipse (16/58)

47 交通大學資訊工程學系 47 New a Project File > New > Project – 選取檔案 File→ 新建 New→ 專案 Project – 剛啟動要設定 Project 的存放位置 ; 不改的話會存在安裝目錄 的 workspace 中。 選取 Java Project 專案,按 Next 下一步。 –Project layout 有兩個選項,差別在於第一個會將原始碼與 編譯好的程式碼放置在專案目錄下,另一個則是分開放在 src 與 bin 資料夾內 輸入專案名稱 Project name ,例如 JavaTest ,按 Next 下一步。 選取程式庫 Libraries 設定 JDK ,按 完成 Finish 。 建立完 JavaTest 專案後,會自動到 Java 顯示視窗。 Eclipse (17/58)

48 交通大學資訊工程學系 48 設定 Project Name 設定 Project name 選擇存放位置,不改的話會存在安裝目 錄的 workspace 中。 Eclipse (18/58)

49 交通大學資訊工程學系 49 設定 JDK 看看 Libraries 的設定,應該是 start.bat 中指定的 Eclipse (19/58)

50 交通大學資訊工程學系 50 切換 Java Perspective 因為支援多種程式語言,所以要選一下 Java Perspective Eclipse (20/58)

51 交通大學資訊工程學系 51 設定 Eclipse 偏好選項 設定偏好選項 preference Eclipse (21/58)

52 交通大學資訊工程學系 52 Eclipse (22/58) 設定 Eclipse Editor 選項

53 交通大學資訊工程學系 53 Eclipse (23/58) 設定 Eclipse 程式碼凹縮排法

54 交通大學資訊工程學系 54 Eclipse (24/58) Eclipse 按鍵設定

55 交通大學資訊工程學系 55 在 Project 中加入檔案 Add >> Class Eclipse (25/58)

56 交通大學資訊工程學系 56 設定 Class 屬性 Eclipse (26/58)

57 交通大學資訊工程學系 57 Run your Java program 點按 Run ( 執行 ) → Run as ( 執行成 ) → Java Application (Java 應用程式 ) 。 這時下面的主控台就會顯示執行結果。 確定你選定有 main() 的 Java 檔 也可以用除錯模式 Debug mode, see next slides.. Eclipse (27/58)

58 交通大學資訊工程學系 58 Eclipse 的 Debug 功能 Eclipse (28/58)

59 交通大學資訊工程學系 59 按 Ctrl+Shift+B 設 Break Point Eclipse (29/58)

60 交通大學資訊工程學系 60 開始除錯 (Eclipse) Eclipse (30/58)

61 交通大學資訊工程學系 61 選擇有 main( ) 的 Java 檔 Eclipse (31/58)

62 交通大學資訊工程學系 62 切換到 Debug Perspective Eclipse (32/58)

63 交通大學資訊工程學系 63 Debug 觀察變數值 游標移到 a 上,看到 a=5 Eclipse (33/58)

64 交通大學資訊工程學系 64 JDT : Java Development Tools State of the art Java development environment Included in Eclipse Project releases –Available as separately installable feature –Part of Eclipse SDK drops Built atop Eclipse Platform –Implemented as Eclipse plug-ins –Using Eclipse Platform APIs and extension points Eclipse (34/58)

65 交通大學資訊工程學系 65 Java Perspective (1/3) Java-centric view of files in Java projects –Java elements meaningful for Java programmers Java project package class field method Java editor Eclipse (35/58)

66 交通大學資訊工程學系 66 Java Perspective (2/3) Browse type hierarchies –“Up” hierarchy to supertypes –“Down” hierarchy to subtypes Type hierarchy Selected type’s members Eclipse (36/58)

67 交通大學資訊工程學系 67 Java Perspective (3/3) Search for Java elements –Declarations or references –Including Libraries and other projects Hits flagged in margin of editor All search results Eclipse (37/58)

68 交通大學資訊工程學系 68 Java Editor (1/7) Hovering over identifier shows Javadoc spec Eclipse (38/58)

69 交通大學資訊工程學系 69 Java Editor (2/7) Method (function) completion in Java editor List of plausible methodsDoc for method Eclipse (39/58)

70 交通大學資訊工程學系 70 Java Editor (3/7) On-the-fly spell check catches errors early Preview Click to see fixes Problem Quick fixes Eclipse (40/58)

71 交通大學資訊工程學系 71 Java Editor (4/7) Code templates help with drudgery Statement template Preview Eclipse (41/58)

72 交通大學資訊工程學系 72 Java Editor (5/7) Method stub insertion for inherited methods Method stub insertion for anonymous inner types Java editor creates stub methods Eclipse (42/58)

73 交通大學資訊工程學系 73 Java Editor (6/7) Variable name suggestion Argument hints and proposed argument names JavaDoc code assist Java editor helps programmers write good Java code Eclipse (43/58)

74 交通大學資訊工程學系 74 Java Editor (7/7) Other features of Java editor include –Local method history –Code formatter –Source code for binary libraries –Built-in refactoring Eclipse (44/58)

75 交通大學資訊工程學系 75 Refactoring (1/4) JDT has actions for refactoring Java code Eclipse (45/58)

76 交通大學資訊工程學系 76 Refactoring (2/4) Refactoring actions rewrite source code –Within a single Java source file –Across multiple interrelated Java source files Refactoring actions preserve program semantics –Does not alter what program does –Just affects the way it does it Encourages exploratory programming Encourages higher code quality –Makes it easier to rewrite poor code Eclipse (46/58)

77 交通大學資訊工程學系 77 Refactoring (3/4) Full preview of all ensuing code changes –Programmer can veto individual changes List of changes “before” vs. “after” Eclipse (47/58)

78 交通大學資訊工程學系 78 Refactoring (4/4) Growing catalog of refactoring actions –Organize imports –Rename {field, method, class, package} –Move {field, method, class} –Extract method –Extract local variable –Inline local variable –Reorder method parameters Eclipse (48/58)

79 交通大學資訊工程學系 79 Eclipse Java Compiler Eclipse Java compiler –JDK-compliant Java compiler –Helpful error messages –Generates runnable code even in presence of errors –Fully-automatic incremental recompilation –High performance –Scales to large projects Multiple other uses besides the obvious –Syntax and spell checking –Analyze structure inside Java source file –Name resolution –Content assist –Refactoring –Searches Eclipse (49/58)

80 交通大學資訊工程學系 80 Eclipse Java Debugger (1/2) Run or debug Java programs Threads and stack frames Editor with breakpoint marks Console I/O Local variables Eclipse (50/58)

81 交通大學資訊工程學系 81 Eclipse Java Debugger (2/2) Run Java programs –In separate target JVM (user selectable) –Console provides stdout, stdin, stderr –Scrapbook pages for executing Java code snippets Debug Java programs –Full source code debugging –Any JPDA-compliant JVM Debugger features include –Method and exception breakpoints –Conditional breakpoints –Watchpoints –Step over, into, return; run to line –Inspect and modify fields and local variables –Evaluate snippets in context of method –Hot swap (if target JVM supports) Eclipse (51/58)

82 交通大學資訊工程學系 82 Eclipse is a Java IDE Widely regarded as the Java development environment With all the bells and whistles… –Language-aware editors, views, … –Refactoring support –Integrated unit testing and debugging –Incremental compilation and build –Team development support Out of the box support for CVS –… Eclipse (52/58)

83 交通大學資訊工程學系 83 Eclipse is an IDE Framework Eclipse + JDT = Java IDE –First class framework for Java –Language aware editor –Incremental build –Integrated debugging Eclipse + CDT = C/C++ IDE –First class framework for C/C++ –Language aware editor –Refactoring, search Eclipse + PHP = PHP IDE Eclipse + JDT + CDT + PHP = Java, C/C++, PHP IDE … Eclipse (53/58)

84 交通大學資訊工程學系 84 Eclipse is a Tools Framework Extensibility through OSGi implementation –Plug-ins make Eclipse whatever you need it to be Focus on developing a universal platform of frameworks and exemplary tools Tools extend the Eclipse platform using plug-ins –Business Intelligence and Reporting Tools (BIRT) –Eclipse Communications Framework (ECF) –Web Tools Project (WTP) –Eclipse Modelling Framework (EMF) –Graphical Editing Framework (GEF) –Test and Performance Tooling Project (TPTP) Plug-in Eclipse (54/58)

85 交通大學資訊工程學系 85 Eclipse is an Application Framework Remove the IDE elements, Java language support, team development support, … and you’re left with a pretty comprehensive general application framework –Support for multiple platforms Linux, Windows, Mac OSX, UNIX, embedded –Rich widget set, Graphics –Native-OS integration (drag and drop, OLE/XPCOM integration) A platform for rich clients Some examples of this later… Eclipse (55/58)

86 交通大學資訊工程學系 86 Eclipse Resources http://www.eclipse.org –In Eclipse terms, a “drop” is a build and the “platform” is another name for the software… download the Platform and you get Eclipse. Don’t get the SDK unless you know you want it http://www.cfeclipse.org –Wiki, how-to, instructions, etc. http://www.myeclipseide.org –Excellent set of tools to flesh out Eclipse http://labs.macromedia.com –FlexBuilder2 and RDS plugin http://www.dopefly.com/pages/cfeclipse.cfm –WIDE variety of info, how-to, and articles on Eclipse, CFE, plugins, etc. http://caterpillar.onlyfun.net/Gossip/JavaGossip- V1/JavaGossip.htm The Java Tutorials http://java.sun.com/docs/books/tutorial/ Eclipse (56/58)

87 交通大學資訊工程學系 87 Eclipse Plug-in Architecture Tool (plug-in) Eclipse Platform Platform Runtime … Tool (plug-in) Tool (plug-in) Workbench Workspace Help Team Eclipse (57/58)

88 交通大學資訊工程學系 88 IBM ’ s IDE History 1996 VisualAge for Java 2001 Eclipse Project 1994 VisualAge for Smalltalk VisualAge Micro Edition Open Source project Eclipse (58/58)

89 交通大學資訊工程學系 89 JetBrains IntelliJ

90 交通大學資訊工程學系 90

91 交通大學資訊工程學系 91 JetBrains IntelliJ IDEA 4.5.4 介面最親切、獲獎無數的 IDE 需要另外安裝 JDK 優點:最貼心的開發環境 缺點:硬體要求高,售價很貴( $499 ) ( 試用版可用 30 天 ) IntelliJ (1/18)

92 交通大學資訊工程學系 92 建立 Project File > New Project ,設定名稱及位置 IntelliJ (2/18)

93 交通大學資訊工程學系 93 設定 JDK 注意這個 + 號 按這個就能 選擇 JDK 目錄 IntelliJ (3/18)

94 交通大學資訊工程學系 94 建立單一模組的 Project (IntelliJ IDEA) IntelliJ (4/18)

95 交通大學資訊工程學系 95 選擇 Java Module (IntelliJ IDEA) IntelliJ (5/18)

96 交通大學資訊工程學系 96 設定 Module 名稱 (IntelliJ IDEA) IntelliJ (6/18)

97 交通大學資訊工程學系 97 選擇 source 檔案要放的位置 (IntelliJ IDEA) IntelliJ (7/18)

98 交通大學資訊工程學系 98 選擇編譯 class 檔案要放的位置 (IntelliJ IDEA) IntelliJ (8/18)

99 交通大學資訊工程學系 99 設定 IntelliJ IDEA IntelliJ (9/18)

100 交通大學資訊工程學系 100 IntelliJ (10/18)

101 交通大學資訊工程學系 101 IntelliJ (11/18)

102 交通大學資訊工程學系 102 IntelliJ (12/18)

103 交通大學資訊工程學系 103 在 Project 中加入檔案 (IntelliJ IDEA) IntelliJ (13/18)

104 交通大學資訊工程學系 104 按 F9 設 Break Point (IntelliJ IDEA) IntelliJ (14/18)

105 交通大學資訊工程學系 105 設定要執行的 class 檔 (IntelliJ IDEA) IntelliJ (15/18)

106 交通大學資訊工程學系 106 設定要執行的 class 檔 (IntelliJ IDEA) 這裡要指定 source 的位置 一定要選擇 含有 main() 的 class 按這個 + 新增 IntelliJ (16/18)

107 交通大學資訊工程學系 107 按 Ctrl+F5 開始 Debug 游標移到 a 上,看到 a=5 切換這裡,可以看到 console 輸出 IntelliJ (17/18)

108 交通大學資訊工程學系 108 IntelliJ IDEA 的 Debug 功能 IntelliJ (18/18)


Download ppt "交通大學資訊工程學系 1 How To Java? 使用 JDK –Microsoft Windows –FreeBSD / Linux 使用 Java IDE ( 注意 ! 很多仍需 JDK 配合 ) –VisualAge for Java (IBM) (Eclipse 前身 ) –Eclipse."

Similar presentations


Ads by Google