Java Eclipse ZK Maven Tomcat Setup
Java Eclipse ZK Maven Tomcat Setup
Working in ZK is fun
TABLE OF CONTENTS
TABLE OF CONTENTS ................................................................................................................................................................................................................ 2 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. SOFTWARES ........................................................................................................................................................................................................................ 3 JAVA SE SETUP ................................................................................................................................................................................................................... 4 MAVEN ..................................................................................................................................................................................................................................... 7 SETTING UP THE ENVIRONMENT VARIABLES .................................................................................................................................................. 8 ECLIPSE INDIGO ...............................................................................................................................................................................................................14 TOMCAT 7 ..............................................................................................................................................................................................................................15 MAVEN M2E INTEGRATION FOR ECLIPSE ..........................................................................................................................................................16 MAVEN INTEGRATION FOR ECLIPSE WTP .........................................................................................................................................................20 CONFIGURE TOMCAT SERVER IN ECLIPSE ........................................................................................................................................................24 ZK STUDIO INSTALLATION USING OFFLINE PACKAGE OPTION ....................................................................................................27 ZK STUDIO INSTALLATION USING ECLIPSE MARKET PLACE ...........................................................................................................30 ZK SAMPLE PROJECT HELLO WORLD ..........................................................................................................................................................34 ZK CE 6.5.0 INSTALLATION ...................................................................................................................................................................................42 ADD ZK MAVEN ARCHETYPE ..................................................................................................................................................................................48 CREATE A "HELLO WORLD" APPLICATION WITH ZK MAVEN ARCHETYPE .................................................................................50
Page 2 of 54
1. Softwares
Download the following software Java SDK http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html Select : Java SE Development Kit 6u21 (jdk-6u21-windows-i586.exe) Note : The above is for windows 32 bit setup. If your windows is 64 bit setup, then select the corresponding setup. Tomcat7 http://tomcat.apache.org/download-70.cgi. Select : 32-bit Windows zip (pgp, md5) Eclipse Indigo http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR2/eclipse-jee-indigo-SR2win32.zip Maven 3.0.4 http://maven.apache.org/download.html Select : apache-maven-3.0.4-bin.zip ZK Studio 1.0.2 http://www.zkoss.org/download/zkstudio Select Offline installation package for Eclipse 3.7 (Indigo) ZK CE 6.5.0
http://www.zkoss.org/download/zk?utm_expid=97361-1&utm_referrer=https%3A%2F%2Fptop.only.wip.la%3A443%2Fhttp%2Fwww.zkoss.org%2Fdownload%2Fzkstudio
Before installation, goto ZK Site and create a account for you. It is free. http://www.zkoss.org/forum/signup.zul?path=http://www.zkoss.org/ Make note of user id and password, because at the end of the installation, you need to give this information.
Page 3 of 54
2. Java SE Setup
The following steps will guide you how to install Java JDK Kit. Double click jdk-6u21-windows-i586
Page 4 of 54
Page 5 of 54
Page 6 of 54
3. Maven
In the c drive , create a folder called Maven Extract the apache-maven-3.0.4-bin into the folder Maven. The folder should look as follows.
Page 7 of 54
Page 8 of 54
Page 9 of 54
Page 10 of 54
Click on New button under System variables. This would open up a window as shown Create following variables in the under the system variables section JAVA_HOME Create an environment variable called JAVA_HOME. The Variable name should be JAVA_HOME. Variable value should be the folder path you installed Java JDK. e.g. C:\Program Files\Java\jdk1.6.0_21
Page 11 of 54
Path Variable Select Path variable from System Variables pan and click Edit.
Now let us append java and Maven folder to the above path as shown here.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.6.0_21\bin;c:\maven\bin;
Page 12 of 54
Now let us verify Both Java and Maven Path are set correctly. Open command prompt and Enter Java Version and mvn version
Page 13 of 54
5. Eclipse Indigo
IDE For java development In the c drive , create a folder called Eclipse Extract the eclipse-jee-indigo-SR2-win32.zip into the folder Eclipse. The folder should look as follows.
Page 14 of 54
6. Tomcat 7
In the c drive , create a folder called Tomcat7 Extract the apache-tomcat-7.0.32-windows-x86.zip into the folder Tomcat7. The folder should look as follows.
Page 15 of 54
Page 16 of 54
Enter Maven in the search box and press enter. Select Maven Integration for Eclipse and Click Install Button
Page 17 of 54
Select all the sub items as shown here and click Next. Follow the on screen instruction to complete the installation
Page 18 of 54
Finally the system will ask you to restart the eclipse as shown here.
Page 19 of 54
Page 20 of 54
Enter Maven Integration for Eclipse WTP in the search box and press enter. Select Maven Integration for Eclipse WTP and Click Install Button
Page 21 of 54
Select all the sub items as shown here and click Next. Follow the on screen instruction to complete the installation
Finally the system will ask you to restart the eclipse as shown here.
Page 22 of 54
Page 23 of 54
Page 24 of 54
Page 25 of 54
Select Tomcat 7 Installation director and JRE as shown and click Finish
Page 26 of 54
Page 27 of 54
Click Add and Type name : ZK Studio and for the location select the zip file zkstudio_1.0.2_indigo.zip which downloaded earlier.
Page 28 of 54
Page 29 of 54
You can skip this step if you are successful for the previous step
Open Eclipse Select Help ->select Eclipse Markpetplace Enter ZK Studio and Click Go
Click Install
Page 30 of 54
After successful installation and close the eclipse and open again.
Page 31 of 54
Page 32 of 54
Page 33 of 54
Page 34 of 54
Page 35 of 54
Note : ZK Studio comes with ZK 6.0.0 Commercial version. In the later section, we will see how to can use latest ZK CE Version which is free
Page 36 of 54
Next step to setup the server . For the target runtime option , Select Apache Tomcat v7.0 and click Next Click Browse Button
Page 37 of 54
Page 38 of 54
Goto Project Explorer and Expand Helloword. Expand Webcontent and Right Click Index.zul file And Select Run as and Select Run on Server as shown here
Page 39 of 54
Page 40 of 54
Page 41 of 54
Page 42 of 54
Page 43 of 54
Page 44 of 54
If you want to change existing Project to ZK CE Version, then Please follow the steps 1. 2. 3. 4. Right Click on the Existing ZK Project (Hello world) and Select Properties Expand ZK in the Tree Select Package Settings Select ZK-bin-6.5.0
Page 45 of 54
Click Apply Button and for the following window, select check box to overwrite the jar file
Page 46 of 54
Now again, we will go back to our hello world and run in the index.zul file
Page 47 of 54
In the catalog file enter http://mavensync.zkoss.org/maven2/ and description enter as ZK Maven Archetype and click verify
Page 48 of 54
Click ok button to close the window and for the Click ok button for Preferences window also. Now we are ready and we will create ZK Application.
Page 49 of 54
15.
In Eclipse, Select File -> New -> Other -> Maven Project
Page 50 of 54
Make sure that Create a simple project is unchecked and click next as shown here.
Page 51 of 54
From the Select an Archetype screen, select ZK Maven Archetype from the catalog dropdown list. And Select zk-archetype-webapp from the list. (At the time of writing this is at version 6.0).
Click Next
Page 52 of 54
Next, fill in details for group id, artifact id, version number and package name.
Page 53 of 54
Click Finish and the Eclipse status bar should say ' Creating zk-archetype-webapp ' and ' Updating Maven Dependencies '. If this is the user's first time dealing with ZK libraries, Maven will download the necessary dependencies to compile and run this example, and would be stored in .m2/repository in the user's home directory.
Page 54 of 54