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

Slides:



Advertisements
Similar presentations
FCU, Department of ECE, IC Design Research Lab. TEL: # 4945 Pre-SIm , Post-Sim.
Advertisements

Divide-and-Conquer. 什麼是 divide-and-conquer ? Divide 就是把問題分割 Conquer 則是把答案結合起來.
第三講 Recode、missing value、假設檢定與信賴區間
布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
: A-Sequence 星級 : ★★☆☆☆ 題組: Online-judge.uva.es PROBLEM SET Volume CIX 題號: Problem D : A-Sequence 解題者:薛祖淵 解題日期: 2006 年 2 月 21 日 題意:一開始先輸入一個.
:Word Morphing ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10508:word morphing 解題者:楊家豪 解題日期: 2006 年 5 月 21 日 題意: 第一行給你兩個正整數, 第一個代表下面會出現幾個字串,
3Com Switch 4500 切VLAN教學.
PowerPoint2010 李燕秋 版面配置 版面配置指的是每一個頁面的內容配置 方式,不同的版面配置會有對應的母片。
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
五小專案 黃詩晴 章乃云. 目錄 計算機 智慧盤 拼圖 記憶大挑戰 數學題庫 心得 參考文獻.
1.1 電腦的特性 電腦能夠快速處理資料:電腦可在一秒內處理數百萬個 基本運算,這是人腦所不能做到的。原本人腦一天的工 作量,交給電腦可能僅需幾分鐘的時間就處理完畢。 電腦能夠快速處理資料:電腦可在一秒內處理數百萬個 基本運算,這是人腦所不能做到的。原本人腦一天的工 作量,交給電腦可能僅需幾分鐘的時間就處理完畢。
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
1. 假設以下的敘述為一未提供 “ 捷徑計算 ” 能力的程式段,試用程 式設計的技巧,使此敘述經此改 寫的動作後,具有與 “ 捷徑計算 ” 之 處理方法相同之處理模式。 if and then E1 else E2 endif.
MS-DOS 作業系統 張基昇 (Microsoft-Disk Operating System).
電腦攻擊與防禦 使用電腦教室 vmware 軟體說 明. 開機說明  選擇第二項 :Xp+VM 開機 Account: SNMG Pass:pc208.
JAVA 程式設計與資料結構 第十章 GUI Introdution III. File Chooser  File Chooser 是一個選擇檔案的圖形介面, 無論我們是要存檔還是要開啟檔案,使 用這個物件都會讓我們覺得容易且舒適。
交通大學資訊工程學系 How To Java? 使用 JDK –Microsoft Windows –FreeBSD 使用 Java IDE ( 很多仍需 JDK 配合 ) –VisualAge for Java (IBM) –JBuilder (Borland) –Visual Café (WebGain)
JDK 的安裝. 內 容 大 綱 JDK 安裝步驟 JDK 的主要工具程式 說明 Java 語言發展工具組 JDK(Java Development Kit) 的安裝與工具組中的主要工具程式。 JDK 是發展 Java 語言必備的工具,我們必須正確的安裝 JDK 工具組才可以正確的設計、開發與執行.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
第 5 章 深入 Response 物件 製作. 網頁的轉向與強制輸出 - 讓網頁轉彎的 Redirect 敘述 運用 Response 物件的 Redirect 方法,將瀏覽器顯 示的網頁,導向至其他網頁,語法如下: Response.Redirect 網頁路徑與名稱 此網頁路徑與名稱  若是導向到同一台.
24-6 設定開始與結束場景中的 程式 最後我們要替這個遊戲收個尾, 幫它把開始 的等待畫面跟結束畫面處理一下。
影像處理學習營 練習(四)製作影片 【下】 影像處理學習營 教師 吳清月. 製作影片 學習重點 一. 設定影片秒數。  加入音樂,與影片做結合。 三. 影片存檔方式之選擇  上傳到網路.
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
3-3 使用幾何繪圖工具 Flash 的幾何繪圖工具包括線段工具 (Line Tool) 、橢圓形工具 (Oval Tool) 、多邊星形 工具 (Rectangle Tool) 3 種。這些工具畫出 來的幾何圖形包括了筆畫線條和填色區域, 將它們適當地組合加上有技巧地變形與配 色, 不但比鉛筆工具簡單,
Matlab Assignment Due Assignment 兩個 matlab 程式 : Eigenface : Eigenvector 和 eigenvalue 的應用. Fractal : Affine transform( rotation, translation,
: Happy Number ★ ? 題組: Problem Set Archive with Online Judge 題號: 10591: Happy Number 解題者:陳瀅文 解題日期: 2006 年 6 月 6 日 題意:判斷一個正整數 N 是否為 Happy Number.
1 MySQL 資料庫的使用 網頁資料庫的基礎 網頁資料庫的基礎 下載與安裝 MySQL 下載與安裝 MySQL 啟動 MySQL 伺服器 啟動 MySQL 伺服器 Web 介面的 MySQL 管理程式 Web 介面的 MySQL 管理程式 MySQL 建立資料庫 MySQL 建立資料庫 在 MySQL.
CH.8 偵錯 Visual Basic CH.8 偵錯 Visual Basic  資三甲   章乃云 三種類型的錯誤 三種類型的錯誤.
20-Jun-15 Eclipse. Most slides from: 2 About IDEs An IDE is an Integrated Development Environment.
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
1-6 動畫的文件屬性 舞台是動畫實際播放的畫面, 所以舞台的大 小與長寬比例對將來動畫的呈現有很大的 影響。 Flash 預設的舞台尺寸是 550 Pixels × 400 Pixels, 背景為白色, 如果要更改舞台大小與 背景色, 請執行『修改 / 文件』命令, 開啟文 件屬性 (Document.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
校外使用圖書館購置之資料庫 龍華大學圖書館. 讀者遠端認證 (RPA) 設定說明  透過圖書館架設完成的 RPA (Remote Patron Authentication) 讀者遠端認證代理主 機系統,讀者於校外或院外 可直接連線使 用本館所提供的資料庫。  若非使用本館電子資料,請勿設定此代理.
從此處輸入帳號密碼登入到管理頁面. 點選進到檔案管理 點選「上傳檔案」上傳資料 點選瀏覽選擇電腦裡的檔案 可選擇公開或不公開 為平台上的資料夾 此處為檔案分類,可顯示在展示頁面上,若要參加 MY EG 競賽,做品一律上傳到 “ 98 MY EG Contest ” 點選此處確定上傳檔案.
資料結構實習-一 參數傳遞.
6-2 認識元件庫與內建元件庫 Flash 的元件庫分兩種, 一種是每個動畫專 屬的元件庫 (Library) ;另一種則是內建元 件庫 (Common Libraries), 兩者皆可透過 『視窗』功能表來開啟, 以下即為您說明。
第二章第二章 Statistica 的工具欄. 本章目標:工具欄之使用 介紹 STATISTICA 是一個非常好用的統計軟體,只 要你對微軟的 Office 套裝軟體有較熟悉的瞭解, 那對 STATISTICA 的工具欄就非常容易掌握。 STATISTICA 的文件組織有四種類型,即 Workbook.
著作權所有 © 旗標出版股份有限公司 第 21 章 文件的權限及保護 功能設定. 本章提要 設定文件讀取權限 保護文件.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
Management Abstracts Retrieval System; MARS 檢索操作.
JAVA 程式設計與資料結構 第二十章 Searching. Sequential Searching Sequential Searching 是最簡單的一種搜尋法,此演 算法可應用在 Array 或是 Linked List 此等資料結構。 Sequential Searching 的 worst-case.
資料結構實習-二.
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
Linguistics phonetic symbols. 先下載 IPA 字型檔案,執行安裝。 由於這個程式的字型目錄設定錯誤, 所以等重新開機時就會發現字型消失。 所以必須根據以下步驟來讓 Windows 加入 IPA 字型。
Chapter 10 m-way 搜尋樹與B-Tree
第12章 多重表單與模組的應用程式 12-1 VB.NET的方案與專案 12-2 模組化VB.NET應用程式 12-3 多重表單的應用程式
概念性產品企劃書 呂學儒 李政翰.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
ArcINFO &Geodatabase 由 ESRI 產生 1970 ArcINFO 一開始被設計在迷你電 腦上, 後來逐漸發展, 在 UNIX 系統上也能 執行, 直到今天, 已經可以在不同的平台上 運作.
函式 Function 東海大學物理系‧資訊教育 施奇廷. 函式簡介 當程式越來越大、越複雜時,程式的維護、 除錯會變得更困難,此時必須引入函式來 簡化程式或將程式分段,將程式重複的部 分改寫為函式,將程式「模組化」 這種作法有下列優點:節省程式發展的時 間、邏輯容易瞭解、程式容易除錯、可分 工合作完成程式.
-Artificial Neural Network- Matlab操作介紹 -以類神經網路BPN Model為例
Android 遊戲設計模組 1 Android 開發環境建構 郭育政 東吳大學資訊管理系 涂昆源 萬能科技大學資訊工程系 余執彰 萬能科技大學資訊工程系 周建興 淡江大學電機工程系 林旭陽 東吳大學資訊管理系 教育部網路通訊人才培育先導型計畫 ─ 課程發展計畫.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 參 資料蒐集的方法.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
OmniFile Full Text 系列資料庫 個人化服務設定步驟. 此相關資料庫之個人化服 務只提供類似專題選粹的 服務,然無提供 mail 通知的 服務,讀者可建立個人 ID , 並儲存檢索策略,日後需 再進入該資料庫,查詢檢 索策略之新進文章。 導航目次 個人化服務說明 個人帳號密碼申請 個人化服務設定.
Microsoft Excel.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
幼兒行為觀察與記錄 第八章 事件取樣法.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
安裝 Android 開發環境 建國科技大學 資管系 饒瑞佶 2013/2 V1. 需要 JDK ( Java Runtime 1.5 above) Eclipse IDE Android SDK ADT.
Eclipse Eclipse An IDE is an Integrated Development Environment Different IDEs meet different needs – BlueJ, DrJava are designed as teaching.
Eclipse 24-Apr-17.
Eclipse. An IDE is an Integrated Development Environment Different IDEs meet different needs BlueJ, DrJava are designed as teaching tools Emphasis is.
Eclipse 27-Apr-17.
Eclipse 20-Sep-18.
Presentation transcript:

交通大學資訊工程學系 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 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 Download and install JDK 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 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 就是 JDK 6.1

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

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

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

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

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

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

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

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

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

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

交通大學資訊工程學系 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 可以搜尋的 Java document

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

交通大學資訊工程學系 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 dosMake /make/nmake 所有檔案拷貝到 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 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 Java IDEs on Windows 1.Microsoft Visual J++ / Visual Studio 2.Borland(CodeGear) JBuilder: 3.Eclipse: 4.JetBrains IntelliJ IDEA:(30 天試用 ) Ps. 後三者均有 Unix 、 Mac 的對應版本

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

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

交通大學資訊工程學系 Eclipse Reference: Eclipse (1/58)

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

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

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

交通大學資訊工程學系 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 Eclipse Setup again 安裝外掛 Jigloo SWT/Swing GUI Builder for Eclipse – 讓 Eclipse 可以像 JBuilderX 一樣使用拖拉方式建構 GUI 的外掛 – 36 Eclipse (6/58)

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

交通大學資訊工程學系 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 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 Download Eclipse 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 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 … Running Different Workspace Customize your working directory by creating a shortcut identifying the eclipse.exe and the working directory Eclipse (12/58)

交通大學資訊工程學系 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 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 Workbench again Menu bar Tool bar Text editor Outline view Running Result Eclipse (15/58)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

交通大學資訊工程學系 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 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 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 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 Java Editor (1/7) Hovering over identifier shows Javadoc spec Eclipse (38/58)

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

交通大學資訊工程學系 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 Java Editor (4/7) Code templates help with drudgery Statement template Preview Eclipse (41/58)

交通大學資訊工程學系 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 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 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 Refactoring (1/4) JDT has actions for refactoring Java code Eclipse (45/58)

交通大學資訊工程學系 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 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 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 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 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 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 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 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 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 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 Eclipse Resources –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 –Wiki, how-to, instructions, etc. –Excellent set of tools to flesh out Eclipse –FlexBuilder2 and RDS plugin –WIDE variety of info, how-to, and articles on Eclipse, CFE, plugins, etc. V1/JavaGossip.htm The Java Tutorials Eclipse (56/58)

交通大學資訊工程學系 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 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 JetBrains IntelliJ

交通大學資訊工程學系 90

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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