Wednesday, September 18, 2013

To show Image in jasper report from BLOB field of MySql Database

Normally we save image in the blob field of mySql database table. To get that image  in the report page of jasper report we need to follow some steps.

1.set your field class type:    java.io.InputStream
2.Write Image Expression :     JRImageLoader.loadImage((byte [ ] )
                               (JRLoader.loadBytes($F{ImageData})))
                                ImageData is the Blob field in the table.
3.Image Expression Class :      java.awt.Image
4.add the following include

  
 

Installing JAVA(JDK) from rpm file in linux


  1. Become root by running su and entering the super-user password.
  2. Change to the directory in which you want to install. Type:
    cd <directory path name>
    For example, to install the software in the /usr/java/ directory, Type:
    cd /usr/java

  3. Uninstall any earlier installations of the Java packages. rpm -e <package_name>
  4. Install the package.
    rpm -ivh jre-7u7-linux-x64.rpm

    To upgrade a package:
    rpm -Uvh jre-7u7-linux-x64.rpm

  5. Delete the .rpm file if you want to save disk space.
  6. Exit the root shell. No need to reboot.


    Link

Command to Reset $JAVA_HOME in linux

Some times we need to change the $JAVA_HOME i our linux environment.

Goto Terminal and open either of the following files using an editor of your choice (vim, nano, etc):

# nano /etc/profile
or
# nano /root/.bash_profile 

(Instead of root you can also change your normal username.)

Then

#export JAVA_HOME=/home/user/jdk1.7.0_02/
#export PATH=$PATH:$JAVA_HOME/bin


After executing this command just execute the below command to check the current home:


#java -version