Java開発環境構築手順
個人的なJava開発環境の構築手順を記述します。普段は構築後のフォルダをzipアーカイブして持ち歩き、Java開発環境を構築するときはアーカイブを展開することで楽に構築できるようにしています。
開発環境の目的
以下を行うための環境を構築します。
- GAE/jを使用するWebアプリケーションの作成。
- Androidアプリケーションの作成。
以下は考慮しません。
- GWTの使用。jQueryなどのJavaScriptライブラリを使用するため。
- SVN、Gitなどのバージョン管理システムのEclipseからの使用。エクスプローラから使用するため。
Java SDKのセットアップ
「Java SDK」をダウンロードしてインストールします。インストール後のフォルダを「C:/eclipse/」以下にコピーします。(例:「C:/Program Files/Java/jdk1.6.0_23/」を「C:/eclipse/jdk1.6.0_23/」にコピーします)
Android SDKのセットアップ
「Android SDK」をダウンロードして「C:/eclipse/」以下に展開します。「C:/eclipse/android-sdk-windows/」が作成されます。
「SDK Manager.exe」を起動して、全てのパッケージをダウンロード、インストールする。
SQLite Studioセットアップ
「SQLite Studio」をダウンロードして、「C:/eclipse/sqlitestudio/」にコピーします。
Eclipseセットアップ
ダウンロード、展開
「Eclipse」をダウンロードして、「C:/eclipse/」以下に展開します。この時点で、フォルダ構成は以下のようになります。
C:/ eclipse/ android-sdk-windows/ eclipse/ jadnt158/ jdk1.6.0_23/ sqlitestudio/
設定
[Window]->[Preferences]を開き、以下のように設定します。
[Preferences] [General] Always run in background=True Show heap status=True [Appearance] [Colors and Fonts] Basic/ Text Font=MS ゴシック, 標準, 9 [Editors] [Text Editors] Undo history size=9999 Insert spaces for tabs=True Show line numbers=True [Spelling] Enable spell checking=False [Workspace] Text file encoding=Other UTF-8 New text file line delimiter=Other Windows [Android] SDK Location=C:\eclipse\android-sdk-windows [Java] [Build Path] Folders=True Source folder name=src/main/java Output folder name=target/classes [Code Style] [Code Templates] Comments/ Types=/** * <p> * </p> */ Fields=/** * <p> * ___${field}___。 * </p> */ Getters=/** * <p> * ___${bare_field_name}___を返します。 * </p> * @return ___${bare_field_name}___。 */ Setters=/** * <p> * ___${bare_field_name}___を設定します。 * </p> * @param ${param} ___${bare_field_name}___。 */ Code/ Getter body=return this.${field}; [Formatter] 「Eclipse [built-in]」を元に新しいプロファイルを作成。 Indentation/ Tab policy=Spaces only Statements within 'switch' body=True Blank Lines/ Before package declaration=1 Before first declaration=1 Before field declarations=1 New Lines/ at end of file=True Line Wrapping/ Maximum line width=9999 Comments/ Maximum line width for comments=9999 [Compiler] Compiler compliance level=1.6 [Editor] [Content Assist] [Auto-Activation] Enable auto activation=False [Save Actions] Perform the selected actions on save=True Format source code=True Additional actions=True Add 'this' qualifier to unqualified field accesses Add 'this' qualifier to unqualified method accesses Qualify accesses to static fields with declaring class Qualify accesses to static methods with declaring class Convert control statement bodies to block Remove unused imports Add missing '@Override' annotations Add missing '@Override' annotations to implementations of interface methods Add missing '@Deprecated' annotations Remove unnecessary casts Remove trailing white spaces on all lines [JadClipse] Path to decompiler=C:\eclipse\jadnt158\jad.exe [JavaScript] [Code Style] [Formatter] 「Eclipse [build-in]」を元に新しいプロファイルを作成。 Indentation/ General settings/ Tab policy=Spaces only Indent/ Statements within 'switch' body=True New Lines/ Insert new line/ at end of file=True Line Wrapping/ Line width and indentation levels/ Maximum line width=9999 Comments/ General settings/ Enable header comment formatting=True Line width/ Maximum line width for comments=9999 [Editor] [Save Actions] Perform the selected actions on save=True Format source code=True Additional actions=True Convert control statement bodies to block Remove trailing whitespaces on all lines [Team] [CVS] [Label Decorations] Text Decorations/ Outgoing Change flag=■ Added flag=◆ [Validation] Disable All [Web] [CSS Files] Encoding=ISO 10646/Unicode(UTF-8) [Editor] Line width=9999 Indent using spaces=Selected Indentation size=4 [HTML Files] Encoding=ISO 10646/Unicode(UTF-8) [Editor] Line width=999 Indent using spaces=Selected Indentation size=4 [JSP Files] Encoding=ISO 10646/Unicode(UTF-8) [XML] [XML Files] [Editor] Line width=999 Preserve whitespace in tags with PCDATA content=True Indent using spaces=True Indentation size=4
zipアーカイブ
「C:/eclipse/」以下をzipアーカイブします。他のPCで作業するときは、アーカイブを展開するだけでJava開発環境を構築できます。
ただし、絶対パスで設定している箇所があるため、展開後フォルダが「C:/eclipse/」ではない場合、設定を変更する必要があります。
異なるパスへの展開に伴う設定の変更
設定の変更箇所は以下の通りです。
[Preferences] [Android] SDK Location [Google] [App Engine] [Web Toolkit] [Java] [Installed JREs] [JadClipse] Path to decompiler