A completed summary of Java Servlet environment set up on Os X 10.9 Mavericks
- Apache Tomcat, XAMPP, PHP, phpMyAdmin, MySQL
I decided to use Java Servlet for my project and this is my first time setting up local web development server on OS X. Here is some notes of this process.
For clean starters, this post of setting up Apache, MySQL, PHP and phpMyAdmin on OS X 10.9 Mavericks works flawless: http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-9-mavericks/. And this post is very informative about Java Servlet Programming: http://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m.
Here is another amazing post about web development environment set up on : http://mallinson.ca/post/osx-web-development
Step 1: For Java Servlet Project, Eclipse IDE for Java EE developer is the best choice and the link is here: https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplersr1 This Eclipse includes Java, and everything for Java EE develop.
Step 2: I installed XAMPP on my machine from: http://www.apachefriends.org/index.html
Before test XAMPP on http://localhost:8080 , I need to stop started MySQL in “SettingPreference->MySQL panel”. MySQL can be started by XAMPP, then open the localhost:8080 in browser. It should display XAMPP page.
Step 3: I configured Tomcat with Eclipse. (A detailed tutorial to follow: http://colorlessgem.blogspot.com/2012/07/eclipse-and-tomcat-on-mac-os-x.html ). Don’t forget to stop XAMPP before Tomcat. Because both of their default port is:8080; Or, change one of default ports to something else. This post explained how to do so for Tomcat on Os X: http://stackoverflow.com/questions/5064733/several-ports-8005-8080-8009-required-by-tomcat-server-at-localhost-are-alre
And create a new project in Eclipse; import SQL script and RUN!
There are two related issues I have had during my process are worth to be noted:
- First one is about Java 1.7 on Mavericks. Because, Oracle’s Java has been disabled by Apple on Os X. So, you have to get Java 1.7 for MAC from this link: http://www.java.com/en/download/faq/java_mac.xml. To see what version of Java in Terminal: java -version.
- The other one is to reset password for root on localhost in MySQL.
The command of set root password in Terminals right after installation:
/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE;
Want to make change later needs to following commands:
./mysql -u root -p
> Enter password: [type old password invisibly]