LoginSignup
23
25

More than 3 years have passed since last update.

MacでJavaの開発環境構築メモ

Last updated at Posted at 2017-02-04

はじめに

MacでJavaの開発環境を構築した時のメモ書きです。

バージョン
Mac 10.11.6
Java 1.8.0_112
Apache Tomcat 8.5.11
Eclipse 4.6.2
Tomcatプラグイン 9.1.2

Java

  1. Javaをダウンロードしてインストール

Eclipse

  1. Eclipseへ移動
  2. 「Eclipse IDE for Java EE Developers」を選択してダウンロード
  3. パーミッションエラー回避のために「/Users」配下に配置します。

clean起動

プラグインなどをインストールしてうまく反映されなかった場合にEclipseをcleanコマンドで起動する。

コマンド
/Users/ユーザ名/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse  -clean

メモリ割り当て設定

  1. インストールしたEclipse.appを右クリック
  2. パッケージの内容を表示
  3. Contents > Eclipse > eclipse.ini
  4. メモリの割り当てを変更
eclipse.ini
Xms256m
Xmx1024m

Apache Tomcatの設定

  1. Apache Tomcatをダウンロードする
  2. 「/Users/ユーザ名/Applications」に配置
  3. ターミナルでtomcatに実行権限を付与
コマンド
chmod 755 /Users/ユーザ名/Applications/apache-tomcat-8.5.11/bin/startup.sh
chmod 755 /Users/ユーザ名/Applications/apache-tomcat-8.5.11/bin/shutdown.sh
chmod 755 /Users/ユーザ名/Applications/apache-tomcat-8.5.11/bin/shutdown.sh

EclipseのTomcatプラグイン設定

【パターン①】
こちらのプラグインはバージョンが古くて入れても使えませんでした。
Sysdeo Eclipse Tomcat Launcher plugin

【パターン②】
こちらの手順もインストール中にエラーになり、入れることが出来ませんでした。
Eclipse>Help>Eclipse Marketplace>Eclipse Tomcat Plugin 9.1.2

エラー内容
Unable to read repository at http://tomcatplugin.sf.net/update/content.xml.
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)

【パターン③】
こちらの手順を試したらインストールして起動ができました。
1. Eclipseのtomcatプラグインをダウンロード
2. Eclipse>help>Install New Software
3. Work withのadd>Archive>手順1でダウンロードしたzipを選択
4. Tomcat Pluginが表示されたらチェックしてインストール
5. Eclipse > 環境設定
6. Tomcat
7. Tomcatバージョンを選択
8. Tomcat Homeを選択(/Users/ユーザ名/Applications/Applications/apache-tomcat-8.5.11)
9. コンテキスト宣言モードを設定

thymeleafエディタ

  1. Eclipse>help>Install New Software
  2. テキストボックスに以下のURLを入力してインストール

http://www.thymeleaf.org/eclipse-plugin-update-site

velocityエディタ

  1. Help>Eclipse Marketplace
  2. 「velocity」で検索
  3. 「veloedit 1.0.7」をインストール

DBViewer

  1. Eclipse>help>Install New Software
  2. テキストボックスに以下のURLを入力してインストール

http://www.ne.jp/asahi/zigen/home/plugin/dbviewer/

逆コンパイル

  1. Help>Eclipse Marketplace
  2. 「JadClipse」で検索
  3. 「Eclipse Class Decompiler 2.9.0」をインストール

チェックスタイル

  1. Help>Eclipse Marketplace
  2. 「check style」で検索
  3. 「Checkstyle Plug-in 8.12.0」をインストール

プロパティエディタ

  1. Help>Eclipse Marketplace
  2. 「properties」で検索
  3. 「Properties Editor」をインストール

ショートカットキーの変更

個人的にデフォルトのショートカットキーだと使いにくかったので変更しました。

コマンド 変更前 変更後
Content Assist control+space command+space
Maximize Active View or Editor control+M command+M
Redo command+shift+Z command+y
Forward History command+] command+←
Backward History command+[ command+→
Line Start command+←
Line End command+→

ネーミングツール

codic

Eclipseの設定変更

空白を表示する

  1. Eclipse > 環境設定
  2. General > Editors > Text Editors
  3. Show whitespace charactersにチェックを入れる

Macのショートカッキーを無効

MacとEclipseのショートカットキーがデフォルト同じになっている。
どちらか変更しないとMacのショートカットキーが優先される。
その際に変更したショートカットキーです。

command + spaceのショートカットを無効

  1. 「システム環境設定」画面を表示
  2. キーボードをクリック
  3. 上にあるタブから「ショートカット」を選択
  4. 「Spotlight>Spotlight 検索を表示」のチェックを外す

control + spaceのショートカットを無効

  1. 「システム環境設定」画面を表示
  2. 「キーボード」をクリック
  3. 上にあるタブから「ショートカット」を選択
  4. 「入力ソース>前の入力ソースを選択」のチェックを外す
23
25
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
25