fc2ブログ

スポンサーサイト

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。

JavaをバージョンアップしたときのEclipseの設定変更あれこれ

OSはWindows7 Pro SP1 64bit。

EclipseはINDIGO(3.7.2)。

JDKを6 update 43から7 update 17にアップデートしたときのメモ。

JDK 7はOracleからダウンロードして普通にインストール。

Eclipseを開いて

Window→Preferences→Java→Compiler→Compiler compliance levelで1.7を選択。

すると下の方に

When selecting 1.7 compliance, make sure to have a compatible JRE installed and activated (currently 1.6). Configure...

とか出るので「Configure...」のところをクリック(あるいはJava→Installed JREsをクリック)。

そこでAdd...ボタンをクリック→Standard VMを選択してNextボタンをクリック。

Directory...ボタンをクリックしてC:\Program Files\Java\jre7を選択してOKボタンをクリック→Finishボタンをクリック。

Installed JREsの一覧に追加されたjre7にチェックを入れてOKボタンをクリック。

The compiler settings have changed. A full rebuild is required for changes to take effect. Do the full build now?
とか出てくるからYesボタンをクリック。

----------- 以下プロジェクトごとに繰り返し -----------
Package Explorerからプロジェクトを右クリック→Properties→Java Compiler→Use compliance from execution environment 'JavaSE-1.6 on the 'Java Build Path'についてるチェックを外す。

すると下の方に

When selecting 1.7 compliance, make sure to have a compatible JRE installed and activated (current 1.6). Configure the 'Installed JREs' and 'Execution Environments'or change the JRE on the 'Java Build Path'.

とか出るので'Java Build Path'のところをクリック。

そこでAdd Library...ボタンをクリック→JRE System Libraryを選択してNextボタンをクリック→Workspace default JRE (jre7)を選択してFinishボタンをクリック。

JRE System Libraary [jre6]を選択してRemoveボタンをクリック→OKボタンをクリック。

The compiler settings have changed. A rebuild of the project is required for changes to take effect. Build the project now?
とか出てくるからYesボタンをクリック。

Package Explorerからプロジェクトを右クリック→Properties→Project Facets→Javaを1.7に変更してOKボタンをクリック。
----------- ここまで -----------

Window→Preferences→Server→Runtime Environments→Apache Tomcat v7.0を選択してEdit...ボタンをクリック→JRE:でjre7を選択してFinishボタンをクリック→OKボタンをクリック。

Window→Preferences→Java→Installed JREs→jre6を選択してRemoveボタンをクリック→OKボタンをクリック

上記プロジェクトごとの変更のところでProperties→Project Facets→Javaの変更をやらないとプロジェクト名の赤バツ印が消えないプロジェクトがあった。

Windows→Show View→Problems

で見ると

Java compiler level does not match the version of the installed Java project facet.

となっていて気付いた次第。
スポンサーサイト



Template Designed by DW99

上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。