CJStudio
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 安裝Eclipse及Java 8流程 ###### tags: `Work` ![](https://i.imgur.com/Ge4rRPs.png) [TOC] # 下載 Java 8 ## 下載 Java 8 步驟 請下載 [Java 8](https://www.oracle.com/tw/java/technologies/javase/javase-jdk8-downloads.html) 。 > 請選 Windows/Mac 86 或 64 請看自己的電腦決定 > 我目前使用 jdk-8u291-windows-x64.exe [color=lightblue] **Note:** 可能需要Oracle帳號,請自行申請一下。 **Note:** 環境變數會用到,所以請記得你的JDK Folder放在哪裡。 ## 確認下載安裝是否成功 在Terminal (cmd) 底下,下以下command: ```= java -version ``` 如果成功會看到以下MSG: >java version "1.8.0_281" Java(TM) SE Runtime Environment (build 1.8.0_281-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)[color=pink] ![](https://i.imgur.com/TW4ASOf.png) # 下載 Lombok ## Lombok 下載網址 請下載[Lombok 檔案](https://projectlombok.org/download) ,下載結束後請改檔案名為 "**lombok.jar**". ## Lombok 設定步驟 如果已經下載Eclipse的話: 1. 請把lombok檔案放報eclipse的檔案夾裡。 2. 用文字編輯器,打開eclipse.ini file,並加入以下行列在文檔的下方最。 ```java= //路徑每個人會有扁不太一樣,所以請自調 -javaagent:../Eclipse/lombok.jar -vmargs -javaagent:lombok.jar ``` **eclipse.ini:** ![](https://i.imgur.com/MaKkDN6.png) **lombok在Eclipse的位子:** ![](https://i.imgur.com/yb791qk.png) **Note:** 如果跑專案 **log**有問題,可能代表lombok沒設定。 如果有設定,請到Project Tab > Clean # 下載 Apache Maven 前往 [Apache Maven 官方網頁](https://maven.apache.org/) ![](https://i.imgur.com/zQTyoSh.png) 下載**apache-maven-3.6.3-bin ZIP** file. ![](https://i.imgur.com/5kbN0LQ.png) **Note:** 環境變數會用到,所以請記得你的Maven Folder放在哪裡。 ## 確認下載安裝是否成功 請 **設定環境變數** 過後再試試看。 >使用者變數 >**Path** >C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin [color=orange] >PS: 不知道哪裡設定環境變數的話,可以看這教學的 **設定環境變數** 的 Section 底下有圖片跟文字敘述。 **如何有成功呢?** 在Terminal (cmd) 底下,下以下command: ```= mvn -version ``` 如果成功會看到以下MSG: >Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin\.. Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_281\jre Default locale: zh_TW, platform encoding: MS950 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"[color=pink] ## 備註: >如果**環境變數都設定好**了,可是**執行 mvn -version** 指令**沒有用**的話,**請重新開機**。 [color=red] # 設定環境變數 ## 打開控制台到環境變數位子 ### 控制台在哪裡呢? 1. 找不到可以再收尋位子找control,就會出現控制台項目。 1. 前往**系統及安全性**。 2. 前往**系統**。 3. 前往**進階系統設定**。 4. 在**進階底下**可以看到**環境變數**紐。 >**STEP 1** ![](https://i.imgur.com/EeqFB0A.png) **STEP 2** ![](https://i.imgur.com/R2Lp5gi.png) **STEP 3** ![](https://i.imgur.com/sunfN7A.png) **STEP 4** ![](https://i.imgur.com/YjOhFPy.png) **STEP 5** ![](https://i.imgur.com/SpVdJEo.png)[color=#a6e2eb] ## 加上新的環境變數 ![](https://i.imgur.com/6qbRibh.png) ### 使用者變數 **Path** C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin ### 系統變數 **JAVA_HOME** C:\Program Files\Java\jdk1.8.0_281 **CLASSPATH** .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar **Path** %JAVA_HOME%\bin %JAVA_HOME%\jre\bin # 下載 Eclipse ## 下載Eclipse Zip File 前往 [Eclipse 官方下載網頁](https://www.eclipse.org/downloads/) ![](https://i.imgur.com/m3YmeW7.png) 在這裡頭前往 [Download Packages](https://www.eclipse.org/downloads/packages/) ![](https://i.imgur.com/rJbmAvp.png) 點擊 **Eclipse IDE for Java Developers**,會倒到別的網頁,在那**點擊下載(Download)**。 ![](https://i.imgur.com/l91lvpT.png) 下載檔案為 **eclipse zip file**. ## 設定Installed JREs ### 打開Installed JREs項目 在Eclipse 開啟後: 1. 請到 **Window > Preferences** 2. 找一下 **Java > Installed JREs** 那邊需要**指向本地的JRE**,就像以下圖一樣。 (下面有加JRE的步驟) **Note:** 如果原本就有的話,請刪除,再重新指向新的。 **Java/ Installed JRE:** ![](https://i.imgur.com/qX7zs8J.png) ### ADD new JRE 1. 確認是否是本地的JRE 2. Installed JREs 裡面**刪除原本的(如果非本地)**,**請按ADD紐**。 3. 會打開一個**JRE Type的Window**,裡頭選**Standard VM**。 4. 請選擇你 **jdk Folder 裡面的 jre folder** 為Directory。 5. 填選你要的名稱,並**按Finish**。 6. 最後按Apply 過後再Apply and Close **Step 3~5 圖案對照:** >**Step 3:** ![](https://i.imgur.com/TBN5PZl.png) **Step 4:** ![](https://i.imgur.com/371Bxix.png) **Step 5:** ![](https://i.imgur.com/d4UbSo4.png) [color=#2e84d5] **Step Overview:** >![](https://i.imgur.com/ifqTE0E.png) [color=#2e84d5] ### Aliyucs 請從**Gitlab > maven > core 3.0.6.jar** ```maven= mvn install:install-file -Dfile=/换成本地路径/core-3.0.6.jar -DgroupId=com.aliyuncs.aliyun -DartifactId=core -Dversion=3.0.6 -Dpackaging=jar ``` ## 設定 m2e ### 取得 Eclipse 需要的 m2e Url 首先開啟 [m2e Eclipse Url](https://www.eclipse.org/m2e/)。 ![](https://i.imgur.com/WYKRps6.png) 進入以上圖的Url過後,請往下滑會看到m2e repository的url。請留下這網頁,並前往Eclipse 軟體。 ![](https://i.imgur.com/zch7i1t.png) **Note:** https://download.eclipse.org/technology/m2e/releases/latest/ (2021/04/15 如果沒有換還是這Link) ### 設定m2e Url在Eclipse Eclipse開啟的情況下: 1. 請前往Help Tab 的 **Install New Software**。 2. 在Install Window,直接按Add。 3. 會請你填寫 name (匿名) 及 Location (這就是m2e的repository url),並Add進去。 4. 勾選選單並且按Next。 **Step 1~5 圖案對照:** >**Step 1:** ![](https://i.imgur.com/e8pa32w.png) **Step 2:** ![](https://i.imgur.com/HqDOPF4.png) **Step 3:** ![](https://i.imgur.com/gdVvbun.png) **Step 4:** ![](https://i.imgur.com/5jtedHI.png)[color=#31dcbd] # 如何確認Eclipse的Maven是否有在使用? 首先: 1. 先把Maven專案import進來。 2. 對專案按右鍵,並且確認有Maven選項。 ![](https://i.imgur.com/xJwjVSo.png) **Note:** Maven裡的**Update Project**會是一個很常用的Option。 # 基本操作 ## 加入多個專案 1. File > Open Project from file system 1. 請選 Parent Folder,購選Working Set 再讓他跑起來 **Note:** 這會需要一些時間。你在右下角,應該會看到一個綠色Bar在跑。 **Step 1~2 圖案對照:** >**Step 1:** ![](https://i.imgur.com/V5IP7BD.png) **Step 2:** ![](https://i.imgur.com/BxK3MBU.png) [color=#cbd2ff] ## Maven Run as + Maven Build..操作 ![](https://i.imgur.com/XkiMqUf.png) 1. 在專案上右鍵會看到 **Run As 選項**: 1. 建議打包時都要先 Maven Clean 2. Maven Install 3. Maven Build... ### Maven Build.. > compile (編譯) ![](https://i.imgur.com/gZv64nQ.png) ### Maven Build.. > clean package (clean + 打包JAR) ![](https://i.imgur.com/bngDRwE.png) **Note:** 用過的**Maven Build.. 到時再Maven Build 可以看到**。 另外打包的檔案,一律都會在 **target folder** 底下。 如果不再target folder, 請看console裡的位子為主(上面會寫path)。 ## 執行JAR 請到 Terminal (CMD) 裡去以下指令: 1. cd jarFolder 2. java -jar jarName.jar ## 基本架構 **pom.xml** 基本上釋放dependency的部份 (3rd party/外掛等) **src/main/java** 基本上都是主要放 java files的目錄 **application-prod-properties** 及 **application.properties** 都是 設定server/spring datasource url(mysql 在這專案)/ spring datasource username/ spring dtasource password/ Dubbo 資料 等. # 檔案尋找 在上方的Bar找 **Search**,並按下 **Quick Search**。 >![](https://i.imgur.com/bU8gDJR.png) [color=orange] 備註: >請按 3 點那把**CASE SENSITIVE 拿掉**,避免難找東西。 另外要記得,只要是多出一個空格,Eclipse 就會找不到,所以注意不要多空格除非是你想要的。 [color=red] ## 專案找API (備註: 不一定符合每個專案) 1. 使用查詢找 "@RequestMapping " 找出一般的API 定義位子 **Step 1:** 使用 **@RequestMapping** 找出定義的API。 例如我們看到 **/listLiveInfo**,如圖的下方。 >**注意:** 要使用它會是 **http:/domain/live/listLiveInfo**。 在這專案的架構上,他會有一個CLASS為上層,這上層會有一個主要路徑,在這例子為 **live**。 [color=red] >![](https://i.imgur.com/mEOVVXD.png)[color=orange] **額外例子:** >/qrcode/generate rollball-tool > src/main/java > controller > QrcodeController [color=lightblue] ## 找出第三方API (備註: 不一定符合每個專案) ### **STEP 1** 專案第三方API (尤其是籃/足球數據) 查詢方式為: 查詢 **leisu.** (api url 顯示) / **@Value** (找使用 api url 的class) **範例:** 用 "leisu." 找出 leisu call 的 "leisu.leagueListUrl" 在 constant-url-bbls-prod.properties 檔案裡 (basketballbasicdatatask > resources) ```Java=== //Example leisu.leagueListUrl=http://xx.xx.com/api/sports/basketball/matchevent/list ``` ### **STEP 2** 使用 leisu.leagueListUrl 找出宣告API的地方,在這範例為ConstantUrlBbLsProperties.class。 這時使用 getleagueListUrl (get + 使用名稱)找 就可以找出使用這API 的位子。 >String params = "user="+userAccount+"&secret="+userSecret; [color=purple] > >// 1.请求球探接口 >ResultBean httpClientResult = HttpClientUtil.doGet(constantUrlBbLsProperties.getLeagueListUrl()+"?"+params); # 備註 ## Eclipse 提示 Eclipse **很慢**,所以要對它有耐心。 # 問題 ## 找不到宣告參數,卻可以使用? (Spring框架專案) ### 方法一 首先看一下是否有以下Import: ```Java= import org.springframework.stereotype.Service; ``` 有的話代表再用Spring框架的注入處理。 一定會想說如果有兩個Class同時繼承同個interface的話,專案會怎麼知道要用哪一個? 首先一定會要被住 **@Autowired** 另外在implement interface的檔案上會有寫 @Service("名稱") 這名稱就會是拿來當被注入的參數名稱。 可以參考以下 StackOverFlow: https://stackoverflow.com/questions/17424140/spring-is-picking-an-interface-implementation-out-of-many-on-its-own/17424382 ### 方法二 首先看一下是否有以下Import有沒有在implement interface的class上: ```java= import org.apache.dubbo.config.annotation.Service; ``` 有的話,這就是使用apache dubbo的注入。 主要會看到的標籤會是 @Reference=(version="x.x") 再注入的地方及 @Service=(version="x.x") 在繼承interface的Class上。 version 對應到就會知道要注入哪一個。 可以參考以下網站: https://www.jianshu.com/p/e01ae2351dbc

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully