Skip to main content

Windows 7でJavaの開発環境をインストール

私は以下の手順でWindows 7上にJavaの開発環境を設定しました。


1.Java SEをダウンロードする。
まだwindows 7 64bit用のJava EEはないようなので、SEをこちらからダウンロードしてみました。
バージョンはJava SE 6.0 update 26です。ちなみに私がダウンロードしたファイルは↓です。
JDKはjdk-6u26-windows-x64.exe
JREはjre-6u26-windows-x64.exe


2.Eclipseをダウンロードする。
バージョンは最新のEclipse Indigoです。こちらからダウンロードできます。解凍して好きな場所に置きます。


3.続いてTomcatをインストールし、設定する。
こちらのページから32-bit/64-bit Windows Service InstallerをクリックしてTomcat 7.0.xをインストールします。

インストール後、Tomcatフォルダにあるconf/tomcat-users.xmlに以下のロールを追加しなければなりません。

もしtomcat-users.xml上書き拒否されている場合は、xmlファイルのオプションのセキュリティにWindowsユーザーの許可を付けて保存する。


4.EclipseにTomcat Pluginを追加する。
こちらのページからtomcatPluginV33.zipをクリックしてダウンロードします。解凍し、com.sysdeo.eclipse.tomcat_3.3.0フォルダーをeclipse/plugins/の中に移します。

eclipseは管理者として実行し、Window→Preferences→Tomcatにてバージョン 7.xを選択します。TomcatホームにTomcatのフォルダーを記入し、コンテキスト宣言モードはService.xmlを選択します。


5.Hello Worldを表示
ここでは詳しいソースは記載しません。サーブレットでもJSPでもいいので、localhostでHello Worldを表示してみて下さい。

うまくいけばすべてのインストールが成功している証です。


以上、ここまでで一応Javaの開発は出来ます。

-------------------------------------------------------------------------------------------------
データベースも入れたいという方は以下も参考にして下さい。

6.データベースをインストールする。
データベースはMySQL 5.5.15をインストールしました。こちらのページから Windows (x86, 64-bit), MSI InstallerのDownloadボタンをクリックし、インストールして下さい。


6.JDBCを設定する。
こちらのページからConnector-J 5.0.8のZIPファイルをダウンロードします。ZIPファイルを解凍し、mysql-connector-java-5.0.8-bin.jarをJDKフォルダの\jre\lib\extにコピーします。

eclipse上でJRE System Libraryにドライバがあることを確認して下さい。

接続できるかどうか、ソースを作成して試して下さい。ここで接続出来れば成功です。

-------------------------------------------------------------------------------------------------
私の場合ここでなぜか接続がうまくいきませんでした。

問題は以下の2点でした。
・MySQLをインストールする時に同時接続数の選択画面で「Decision Support(DSS)/OLAP」を選んだ場合、なぜかうまく接続出来なくなる。
・ファイアーウォールでブロックされている。

解決策として、
my.iniの中のmysqldにあるskip-networkingをコメントアウトします。
・コントロール パネル→管理ツール→セキュリティが強化された Windows ファイアウォール
を開き、ファイアーウォールを無効にする。


-------------------------------------------------------------------------------------------------
とりあえず以上のやり方だと環境設定のCLASSPATHやPathにドライバを追加する必要もなく、hostsを書き直す事もなくうまくいきました。


【おまけ】
今回は開発環境ということだったので、Tomcatだけでいいですが、本番の場合はTomcatとApatchを連携させる必要があります。
一応Apacheのダウンロードページはこちらになります。httpd-2.2.16-win32-x86-openssl-0.9.8o.msi
をクリックしてインストールして下さい。
連動方法はこちらのサイトを参考に出来ます。


以上、Javaの開発環境の設定についてでした。

Comments

Popular posts from this blog

How to deploy your PHP and Java file in PHP/JavaBridge

Here I explain how to deploy your PHP and Java file in your PHP/JavaBridge folder. You may need basic knowledge of Linux command, PHP , Java , Tomcat . Please use the link below to go to further reading if necessary. I. How to install Java II. How to install Tomcat III. How to install PHP and CGI IV. How to deploy PHP/JavaBridge V. How to deploy your PHP and Java files V. Deploy your PHP and Java file In this chapter, I will not talk detail about how to create and run Java . If you are curious about how to create PHP that executes Java , check PHP/JavaBridge site. 1. Create Java Hello World 1.1. Open eclipse and create Java Project . 1.2. Create HelloWorld.java file under the project. import javax.swing.JOptionPane; public class HelloWorld {     public static final String JAVABRIDGE_PORT="8080";     static final php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner.getInstance(JAVABRIDGE_PORT);     public stat...

How to install PHP/JavaBridge on Mac 

Looking for how to execute Java from PHP or vice versa? By using PHP/JavaBridge , it is possible! Here I write the instraction of how to set up PHP/JavaBridge on your Mac . You may need basic knowledge of Linux command, PHP , Java , Tomcat . Please read following links. I. How to install Java II. How to install Tomcat III. How to install PHP and CGI IV. How to deploy PHP/JavaBridge V. How to deploy your PHP and Java files If you have any suggestion and question, especially technically and grammatically, please feel free to leave your comment. Thank you for your visit😊

How to install Java on your Mac 

Here I explain about how to install Java on your . You may need basic knowledge of Linux command, PHP , Java , Tomcat . Please use the link below to go to further reading if necessary. I. How to install Java II. How to install Tomcat III. How to install PHP and CGI IV. How to deploy PHP/JavaBridge V. How to deploy your PHP and Java files I. How to install Java 1. Download JDK Install most up-to-date JDK from Oracle site . Click downloaded dmg file and follow the guidance. Please follow the step explain this site if you have problem following the instruction. 2. Set up JAVA_HOME 2.1. Open Terminal and enter the following command. vim ~/.bash_profile 2.2. Enter  i  to change to insert mode. 2.3. Add JAVA_HOME as follow. export JAVA_HOME=/Library/Java/JavaVirtualMachines/{your JDK folder}/Contents/Home 2.4. Press esc button and enter  :wq  to save and quit the .bash_profile . 2.5. Enter the command below to update bash source .bash_p...