January 3, 2017

Setting up Java, Eclipse, MySQL and Tomcat in Windows for Java Web Developement

1. Download Java Dev Kit (JDK, not JRE) from here : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Important : write down the installation folder. This is your JAVA_HOME variable.


2. Set Envinronment Variables for Java.
Step 1 : Right Click on MyComputer and click on properties .
Step 2 : Click on Advanced tab
Step 3: Click on Environment Variables (bottom left)
Step 4: At User Variable section (top), create a few variables as below. You need to enter the Variable name and then the value:
    JAVA_HOME : C:\Program Files\Java\jdk1.8.0_112 (put your actual Java installation)
    JDK_HOME  : %JAVA_HOME%
    JRE_HOME  : %JAVA_HOME%\jre
    CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib

Step 5: At System Variable section (bottom), find a variable named PATH or path and at the end of the value with the following;

for Windows 8 and below;
    C:\Program Files\Java\jdk1.8.0_112\bin (your actual Java installation and within bin folder)
    Note the the semicolon at the front of the path.

or for Windows 10, click New and add the above path.


3. Check if everything is OK. Run command line tool (press Windows + x or use search for "cmd"). Run java -version and javac -version which should show the version.


4. Install Eclipse (use this Eclipse Java EE version) : http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neon2


5. Install Tomcat 8 : http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.exe
Note : Write down the installation folder, the webapps folder. You may bookmark or create shortcut of the folder on your Desktop.

Tomcat should be running afterwards. You may browse to http://localhost:8080 to check that your Tomcat is installed fine.


6. Install MySQL server : https://dev.mysql.com/downloads/file/?id=467606
Click on the "No thanks, just start my download."

Once installed, run the MySQL installer. Select from the product list (click on + sign) the MySQL server and then execute.

Upon configuration, setup password for root and another user login (if you want). Rename the service name to MYSQL and set it to auto run at startup. You may want to create log files for each of the logs i.e. error, general and slow query logs.