# 匯入匯出 和環境設定
# export匯出
* export匯出 /general/archive File

* 選擇你要輸出的專案數量、路徑、和輸出格式,再輸入你要儲存的檔名,在finish就完成export
>記得不要匯出和匯入server,最初創好server後就不要再動到了!

# import匯入
* import匯入前先解壓縮檔案,如果你想測試匯入匯出,匯入前記得先把專案刪除(包含跟目錄下的檔案,記得勾選)
* import/existing projects into workspace

* 選擇你之前匯出的檔案路徑,下面options記得勾選copy projects into workspace/ finish/yes to all

---
- 匯出一樣是archive解壓縮後的資料夾
第二種匯入方式:
file/open projects from fileSystem or Archive
選擇解壓縮後的檔案,會直接開啟指定資料夾的專案。
不會匯入server,匯入前一樣要先刪除舊的專案。
---
# 匯入匯出
新建資料夾裡面再新建一個workspace資料夾 /新建server/新建 new dynamic project /新建 new servlet測試後 /就能更改server.xml 和context.xml,之後再匯入專案
## Tomcat 設定JNDI DataSource
- context.xml在終止標籤前打 (這裡context指的是JNDI)
透過JNDI去找DataSource (JNDI lookup)
- "java:/comp/env/jdbc/xxx"
- xxx你取的名子,是對應context.xml和server.xml裡面的name="jdbc/xxx"
- context.xml 裡面的global應該也要一一樣

* context.xml 在context結束標籤前面新增ResourceLink標籤
```
<ResourceLink type="javax.sql.DataSource"
global="jdbc/servdb"
name="jdbc/servdb" />
```
- server.xml 在GlobalNamingResources標籤內,另一個Resource上打
```
<Resource auth="Container" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" initialSize="5" maxIdle="5" maxTotal="8" maxWaitMillis="-1" name="jdbc/servdb" password="sa1234" poolPreparedStatements="true" type="javax.sql.DataSource" url="jdbc:sqlserver://localhost:1433;databaseName=servdb;TrustServerCertificate=True" username="sa" validationQuery="select 1"/>
```

---
* 404檔案拖到資料夾外面再拖回去就能解決
* server不要動,每次先刪除舊的專案,再匯入新的
---
* 匯出檔案不會影響到tomcat
* 只要不要連同server一起匯出就好
---
# **設定eclipse sout快速鍵**
1. 先到preference
Java/editor/templates
選擇edit/new
要設定簡寫/完整句子和所屬種類
通常都是選java statement這個種類

```
System.out.println(${word_selection}${});${cursor}
```
表示會跑出System.out.println();
並讓游標停留在()中間。
2. contentassist/Auto_Activation里的
第二项‘Auto activation triggers for java:’ 后面的文本框输入字母a-z,這樣才能透過sout enter來跑出
```
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
```
---
- 設置System.out.printf 快速鍵outf

>設定跟sout基本一樣只有改name而已
---
匯入preference之後,windows preference/java/installed jres/ 之前上課是jdk8 要點選另一個,然後apply and close就完成設定。
要確認一下windows preference/java/complier 的jre版本
更改comment顏色: windows preference/java/editor/syntax coloring/ comments / multi-ling comment +single-line comment
---
