ZK framework – (instalace – poznámky)

http://www.zkoss.org/doc/installzk.dsp
http://wiki.centos.org/HowTos/JavaOnCentOS

——–

Poznámky – závislosti: yum groupinstall „Development Libraries“

– odinstalovat všechnu ostatní javu i tomcat
– nainstalovat sun javu a nastavit
– nainstalovat tomcat
sh /usr/src/redhat/SOURCES/jdk-6u11-linux-x64.bin
sh: /usr/src/redhat/SOURCES/jdk-6u11-linux-x64.bin: No such file or directory
http://mirrors.dotsrc.org/jpackage/1.7/generic/SRPMS.non-free/

pak /usr/share/tomcat5 instalace zk

 

Installing ZK

Installing Java SDK

If you haven’t installed Java SDK yet, please download and install SUN Java Standard SDK.

Installing Tomcat 5.5

Install the most updated Tomcat first. Or you could find the document from Tomcat Setup.

Downloading ZK Library

Download ZK library(professional edition) for your operating systems.

Create ZK Project

+zkdemo   +WEB-INF     web.xml   index.zul 
  1. Create project
  2. Create a development directory under $TOMCAT_HOME/webapps.
    The structure of development directory is shown below:(ex.zkdemo)

  3. Unzip ZK library
    Unzip zk-bin-prof-xxx.zip or zk-bin-prof-xxx.tar.gz (ex. zk-bin-prof-x.x.x.zip)
  4. Deploy ZK library
    Copy the following jar files to the $TOMCAT_HOME/webapps/$PROJECT_NAME/WEB-INF/lib (ex.zkdemo/WEB-INF/lib)
    • dist/lib/*.jar
    • dist/lib/zkforge/*.jar
    • dist/lib/ext/*.jar
  5. Create web.xml
    Create web.xml under $TOMCAT_HOME/webapps/zkdemo, and Copy the following lines into web.xml
            Used to clean up when a session is destroyed     ZK Session Cleaner     org.zkoss.zk.ui.http.HttpSessionListener            ZK loader for ZUML pages     zkLoader     org.zkoss.zk.ui.http.DHtmlLayoutServlet            update-uri       /zkau          1           zkLoader     *.zul           zkLoader     *.zhtml            The asynchronous update engine for ZK     auEngine      org.zkoss.zk.au.http.DHtmlUpdateServlet           auEngine     /zkau/*    
  6. Create index.zul
    Create index.zul under $TOMCAT_HOME/webapps/zkdemo/, and copy the following lines into it.
     	Hello, World!   
  7. Start Tomcat
    Execute $TOMCAT_HOME/start.bat to activate Tomcat.
    (ex. C:\Program Files\apache-tomcat-5.5.23\bin\start.bat)
  8. Browse zkdemo
    Browse to http://localhost/zkdemo/ or http://localhost:8080/zkdemo/ depending on your configuration for Tomcat.
 
 
 

Install Sun Java and Tomcat on CentOS 5

I am not a big fan of any Redhat or derivative distributions, but this time I was forced to use CentOS because the RAID card of the server is only well supported by RHEL and (therefore) CentOS. As a newbie of RPM and yum, my way of doing things can be quite stupid. So I’d appreciate your comments and corrections.

First, the default Java environment on CentOS is GIJ, as are most Linux Distros. So the first thing to do is to get official Java 6 installed. Though there are tutorials creating RPM package from Sun’s distributed files, I am just setting up this one machine and will just install Sun’s binary distribution directly.

  • Download the binary distribution from Sun’s website: http://java.sun.com/javase/downloads/index.jsp. Make sure you download the “self-extracting file” for “Linux Platform”.
  • You can also copy the URL to the download file, and use `wget’ to download from command line. What I did was:
    cd ~/Desktop wget http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin 
  • Now run that installer file. Before you run it, you must tell Linux it is safe to run it, and then run it:
    chmod u+x jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin ./jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin 
  • This just extracts the JRE into the current folder. We need to move it to a permanent location of your choice. Any location would work. I chose /usr/lib. So I did:
    mv jre1.6.0_10 /usr/lib/ 
  • Because we might update to a new JRE in the future, and we hate to change all things that are dependent on JRE location after that update (think about change 20 JAVA_HOME settings after each JRE update), we will set up a symbolic link (shortcut in Windows vocabulary) for JRE. In the future, when we update JRE, we just update that link to get all other programs to use the new JRE:
    cd /usr/lib ln -s jre1.6.0_10 jre 
  • In the future, when we need to set JAVA_HOME, we will set it to the link /usr/lib/jre, which always points to the latest JRE. So when getting a new JRE, we just update this link, and do not need to change JAVA_HOME for each programs we use. You can also set up a global JAVA_HOME for programs that respect it:
    echo "export JAVA_HOME=/usr/lib/jre" >> ~/.bashrc 

    The above command will append one export line bash’s configuration, which bash will read every time it starts. You may also do

    echo "export PATH=$JAVA_HOME/bin:$PATH" >> ~/.bashrc 

    so that every time you type java on the command line it will use the latest Java.

Now it’s time to download and set Tomcat in almost the exact same way:

  • Download binary distribution of Tomcat from http://tomcat.apache.org/download-55.cgi. I would choose the .tar.gz file (also known as tarball):
    cd ~/Desktop wget http://download.nextag.com/apache/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.tar.gz 
  • Now decompress it. The way to decompress a tarball is almost always:
    tar -xzf apache-tomcat-5.5.27.tar.gz 

    This will give you a new folder (named apache-tomcat-5.5.27 in my case) that contains the tomcat program.

  • Now move the new folder to a permanent location. As for the JRE above, any location would work. I chose /opt, where people typically use to store relatively independent programs:
    mv apache-tomcat-5.5.27 /opt/tomcat-5.5 

    This command moves the new tomcat folder to /opt and renames it to tomcat-5.5.

  • Similar to setting up JAVA_HOME, we will also need to set up CATALINA_HOME. So do:
    echo "export CATALINA_HOME=/opt/tomcat-5.5" >> ~/.bashrc echo "CATALINA_BASE=/opt/tomcat-5.5"  >> ~/.bashrc 

That’s it. Close the terminal window and start a new one so that all new settings get loaded. You should now be able to start Tomcat by running familiar things like /opt/tomcat-5.5/bin/catalina.sh start

Installing ZK

Installing Java SDK

If you haven’t installed Java SDK yet, please download and install SUN Java Standard SDK.

Installing Tomcat 5.5

Install the most updated Tomcat first. Or you could find the document from Tomcat Setup.

Downloading ZK Library

Download ZK library(professional edition) for your operating systems.

Create ZK Project

+zkdemo   +WEB-INF     web.xml   index.zul 
  1. Create project
  2. Create a development directory under $TOMCAT_HOME/webapps.
    The structure of development directory is shown below:(ex.zkdemo)

  3. Unzip ZK library
    Unzip zk-bin-prof-xxx.zip or zk-bin-prof-xxx.tar.gz (ex. zk-bin-prof-x.x.x.zip)
  4. Deploy ZK library
    Copy the following jar files to the $TOMCAT_HOME/webapps/$PROJECT_NAME/WEB-INF/lib (ex.zkdemo/WEB-INF/lib)
    • dist/lib/*.jar
    • dist/lib/zkforge/*.jar
    • dist/lib/ext/*.jar
  5. Create web.xml
    Create web.xml under $TOMCAT_HOME/webapps/zkdemo, and Copy the following lines into web.xml
            Used to clean up when a session is destroyed     ZK Session Cleaner     org.zkoss.zk.ui.http.HttpSessionListener            ZK loader for ZUML pages     zkLoader     org.zkoss.zk.ui.http.DHtmlLayoutServlet            update-uri       /zkau          1           zkLoader     *.zul           zkLoader     *.zhtml            The asynchronous update engine for ZK     auEngine      org.zkoss.zk.au.http.DHtmlUpdateServlet           auEngine     /zkau/*    
  6. Create index.zul
    Create index.zul under $TOMCAT_HOME/webapps/zkdemo/, and copy the following lines into it.
     	Hello, World!   
  7. Start Tomcat
    Execute $TOMCAT_HOME/start.bat to activate Tomcat.
    (ex. C:\Program Files\apache-tomcat-5.5.23\bin\start.bat)
  8. Browse zkdemo
    Browse to http://localhost/zkdemo/ or http://localhost:8080/zkdemo/ depending on your configuration for Tomcat.

Inline Translator does not loaded. Refresh browser to retry.

ZK framework – (instalace – poznámky)