Thursday, July 2, 2009

MyEclipse upgrade - making a war file

In the older version of MyEclipse, we used JBoss plugin for Eclipse for .war file generation. But after the upgrade to MyEclipse 7.1, the JBoss plugin simply doesn't work anymore.

Of course, we could always write our own deployment descriptor, run ANT, and generate the .war file. But that also means install ANT on every developer's local machine, configure the path, go to command line every time, not something easy for everyday life.

So, after some research, here's the alternative:

Although MyEclipse does not require Tomcat plugin, we could just set the path and run different versions of Tomcat. But if we add the Tomcat plugin, we could generate .war file!

Step 1: Right click the project name -> properties

Step 2: Choose Tomcat from the bottom, then click Export to WAR settings.

Step 3: Browse to the correct directory and give the WAR file name.

Step 4: Click Apply and close the properties page.

Step 5: Right click the project name -> Tomcat Project -> Export to the WAR file sets in project properties.

Now we have a .war file ready to be deployed.

XSL-FO checkbox using unicode

When using xsl-fo to generate PDF, according to FO documentations, the best way is to use unicode fonts instead of using fo:external-graphics. After searching the web, I didn't find the best solution, but found a lot of useful information. The existing solution is, there is a way to draw a unchecked box using font "ZapfDingbats", but there is no checked box. For the unchecked box, here's code:

<fo:inline font-family="ZapfDingbats" font-size="10pt">&#x274F;</fo:inline>

For the cheked box, here's my solution:

<fo:inline font-family="ZapfDingbats" font-size="6pt" border="1pt black solid">&#x2715;</fo:inline>
Try to use "X" plus the border to create the checked box.

Monday, May 11, 2009

RedHat Linux JDK1.6 and Tomcat 1.6 installation

The current java on wwwp path is: /usr/lib/jvm/jre-1.6.0-sun.x86_64/bin/java
We need the Java JDK instead of Jre.

Downloaded current JDK 1.6 from Sun web site: jdk-6u13-linux-x64-rpm.bin
> cp -p /tmp/jdk-6u13-linux-x64-rpm.bin /var/www/.

> chmod a+x /var/www/jdk-6u13-linux-x64-rpm.bin
> ./jdk-6u13-linux-x64-rpm.bin
> /usr/sbin/alternatives --install /usr/bin/java java /usr/java/latest/bin/java 1
> /usr/sbin/alternatives --config java choose the java you wanted.

Package name is "jdk-1.6.0_13-fcs". To view the package info, use command:
>rpm -qc jdk

Download Tomcat 1.6 tar.gz
> tar -zxvf jakarta-tomcat-6.x.xx.tar.gz

Create a symbolic link to a tomcat directory:
> ln -s apache-tomcat-6.0.26 tomcat

After install Tomcat, use another user account instead of root to run the Tomcat:
1. Add a group:
> /usr/sbin/groupadd other

2. See if the group is added:
> grep other /etc/group
If you see something like this, it is added, otherwise do it again:
> other:x:1000000:

3. List users:
> cat /etc/passwd