How to setup:
Eclipse with Java JDK, Tomcat, and PostrgreSQL
as a portable development environment in Windows.
Download Eclipse IDE for Java EE Developers (eclipse-jee-indigo-SR1-win32.zip) at:
http://www.eclipse.org/downloads/
Unzip in C:\eclipse.
Download Java Platform (JDK) 7u1 (jdk-7u1-windows-i586.exe) at:
http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Unfortunately, it's an exe file so you have to install it, then move the JDK, then uninstall java.
Open explorer to C:\Program Files\Java, then drag the jdk1.7.0_01 folder into C:\eclipse folder.
Edit C:\eclipse\eclipse.ini.
Insert and save this two lines at the VERY TOP:
-vm
.\jdk1.7.0_01\bin\javaw
Download Tomcat 7.0 (under Binary Distributions, Core, as apache-tomcat-7.0.22.zip) at:
http://tomcat.apache.org/download-70.cgi
Unzip in C:\eclipse\apache-tomcat-7.0.22.
Now run eclipse.
It will ask you where to save the workspace; save to C:\eclipse\workspace, and check never to ask again.
Click on workbench (top, right).
Click on servers tab (middle tab at bottom window).
Right click on white area, click new, click server.
Click apache, click on tomcat v7.0 server, click next.
Enter for tomcat installation directory: C:\eclipse\apache-tomcat-7.0.22.
Click next
Now run tomcat by clicking on the start the server icon (round green w/ white triagle) or Ctrl+Alt+R.
Now open a browser to http://localhost:8080/ and it should display an HTTP Status 404 error because it's an empty project. If you did have apps, it gets deployed here: C:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps which is created when you first run tomcat.
Check here for a how to load an example project and run it:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html
See the section "Import and Test a Sample App".
Basically, download the test-app.zip to your desktop.
In eclipse, go to File | Import | General | Existing Projects into Workspace | Select archive file by browsing to the desktop and select test-app.zip | and click Finish.
Next, right click on Tomcat server (bottom window) | Add and Remove | select test-app from Available column, click Add > to add to the Configured column | click Finish.
And lastly, run Tocmat, and open your browser to http://localhost:8080/test-app/.
To create a war file for deploying your app, right click on test-app in the Project Explorer window on the left of eclipse | Export | War file | and enter or browse destination for the war file | click Finish.
Download postgresql zipped archive (postgresql-9.1.1-1-windows-binaries.zip) at:
http://www.postgresql.org/download/windows/
for the zip archive linked to http://www.enterprisedb.com/products-services-training/pgbindownload.
Click on the win x86-32 icon to download the file.
Unzip in C:\eclipse\pgsql.
Create the start-postgres.bat in C:\eclipse, save it, and run it. It is setup to initialize the posgresql.
[start-postgres.bat]
When it is done initializing, edit C:\eclipse\start-postgres.bat.
Rem the initdb line like this: REM "%~dp0\bin\initdb" -U postgres -A trust
Unrem pgAdmin3 line like this: %~dp0\pgsql\bin\pgAdmin3
Save it.
To start postgres, just run C:\eclipse\start-postgres.bat.
Close pgadmin3 normally and the batch file will shutdown postgres.
*April 9, 2014: If you get an error due to a missing dll, you'll need to install Microsoft Visual C++ Distributable Package; version 2012 did not work for me, I had to install version 2010 here http://www.microsoft.com/en-us/download/details.aspx?id=5555
Download the jdbc from http://jdbc.postgresql.org/download.html into C:\eclipse\apache-tomcat-7.0.22\lib. For jvm 1.7, recommended download: http://jdbc.postgresql.org/download/postgresql-9.1-901.jdbc4.jar
Run eclipse. Click on Help | Install New Software. Select Work With: Indigo - http://download.eclipse.org/releases/indigo | click on the + Database Development | check Data Tools Platform Enablement Extender SDK | Finish.
This example jsp page (transaction.jsp) opens, reads, closes a postgresql.
Create a new jsp page in the test-app project.
[transaction.jsp]
Eclipse with Java JDK, Tomcat, and PostrgreSQL
as a portable development environment in Windows.
Download Eclipse IDE for Java EE Developers (eclipse-jee-indigo-SR1-win32.zip) at:
http://www.eclipse.org/downloads/
Unzip in C:\eclipse.
Download Java Platform (JDK) 7u1 (jdk-7u1-windows-i586.exe) at:
http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Unfortunately, it's an exe file so you have to install it, then move the JDK, then uninstall java.
Open explorer to C:\Program Files\Java, then drag the jdk1.7.0_01 folder into C:\eclipse folder.
Edit C:\eclipse\eclipse.ini.
Insert and save this two lines at the VERY TOP:
-vm
.\jdk1.7.0_01\bin\javaw
Download Tomcat 7.0 (under Binary Distributions, Core, as apache-tomcat-7.0.22.zip) at:
http://tomcat.apache.org/download-70.cgi
Unzip in C:\eclipse\apache-tomcat-7.0.22.
Now run eclipse.
It will ask you where to save the workspace; save to C:\eclipse\workspace, and check never to ask again.
Click on workbench (top, right).
Click on servers tab (middle tab at bottom window).
Right click on white area, click new, click server.
Click apache, click on tomcat v7.0 server, click next.
Enter for tomcat installation directory: C:\eclipse\apache-tomcat-7.0.22.
Click next
Now run tomcat by clicking on the start the server icon (round green w/ white triagle) or Ctrl+Alt+R.
Now open a browser to http://localhost:8080/ and it should display an HTTP Status 404 error because it's an empty project. If you did have apps, it gets deployed here: C:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps which is created when you first run tomcat.
Check here for a how to load an example project and run it:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html
See the section "Import and Test a Sample App".
Basically, download the test-app.zip to your desktop.
In eclipse, go to File | Import | General | Existing Projects into Workspace | Select archive file by browsing to the desktop and select test-app.zip | and click Finish.
Next, right click on Tomcat server (bottom window) | Add and Remove | select test-app from Available column, click Add > to add to the Configured column | click Finish.
And lastly, run Tocmat, and open your browser to http://localhost:8080/test-app/.
To create a war file for deploying your app, right click on test-app in the Project Explorer window on the left of eclipse | Export | War file | and enter or browse destination for the war file | click Finish.
Download postgresql zipped archive (postgresql-9.1.1-1-windows-binaries.zip) at:
http://www.postgresql.org/download/windows/
for the zip archive linked to http://www.enterprisedb.com/products-services-training/pgbindownload.
Click on the win x86-32 icon to download the file.
Unzip in C:\eclipse\pgsql.
Create the start-postgres.bat in C:\eclipse, save it, and run it. It is setup to initialize the posgresql.
[start-postgres.bat]
When it is done initializing, edit C:\eclipse\start-postgres.bat.
Rem the initdb line like this: REM "%~dp0\bin\initdb" -U postgres -A trust
Unrem pgAdmin3 line like this: %~dp0\pgsql\bin\pgAdmin3
Save it.
To start postgres, just run C:\eclipse\start-postgres.bat.
Close pgadmin3 normally and the batch file will shutdown postgres.
*April 9, 2014: If you get an error due to a missing dll, you'll need to install Microsoft Visual C++ Distributable Package; version 2012 did not work for me, I had to install version 2010 here http://www.microsoft.com/en-us/download/details.aspx?id=5555
Download the jdbc from http://jdbc.postgresql.org/download.html into C:\eclipse\apache-tomcat-7.0.22\lib. For jvm 1.7, recommended download: http://jdbc.postgresql.org/download/postgresql-9.1-901.jdbc4.jar
Run eclipse. Click on Help | Install New Software. Select Work With: Indigo - http://download.eclipse.org/releases/indigo | click on the + Database Development | check Data Tools Platform Enablement Extender SDK | Finish.
This example jsp page (transaction.jsp) opens, reads, closes a postgresql.
Create a new jsp page in the test-app project.
[transaction.jsp]