How to setup:
Eclipse with Java JDK, Tomcat, and PostrgreSQL
as a portable development environment in Windows.
Unzip in C:\eclipse.
Download Java Platform (JDK) 7u1 (jdk-7u1-windows-i586.exe) at:
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.
Insert and save this two lines at the VERY TOP:
Download Tomcat 7.0 (under Binary Distributions, Core, as apache-tomcat-7.0.22.zip) at:
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.
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:
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:
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.
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
To start postgres, just run C:\eclipse\start-postgres.bat.
Close pgadmin3 normally and the batch file will shutdown postgres.
Download the jdbc from http://jdbc.postgresql.org/download.html into C:\eclipse\apache-tomcat-7.0.22\lib. For jvm 1.7 or 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.
Then in eclipse, run tomcat, and open your browser to http://localhost:8080/test-app/transaction.jsp.
In eclipse, you can also connect to the postgres database.
To the top, right of eclipse, click on the Open Perspective icon | Other | Database Development | Ok.
To the left window, right click on Database Connections | New | click on PostgreSQL | change Name: to AAT PostgreSQL | Next
Click on the New Driver Definition icon to the left of the Drivers box.
In the Name/Type tab, click on the PostgreSQL JDBC Driver in the Available driver templates, and change the Driver Name: PostgreSQL9 JDBC Driver.
In the JAR List tab, Remove all the Driver Files, then click Add JAR/Zip, navigate to apache-tomcat-7.0.22\lib and click on our postgres driver (postgresql-9.1-901.jdbc4.jar), and Open.
In the Properties tab, change to these:
User name: aat
check checkbox for Save password
If all went well, in the Data Source Explorer window (left of eclipse), under Database Connections you should see the AAT PostgreSQL and below that the aat database which lets you navigate to the aat tables, data, etc.