Difference between revisions of "Install Java Advanced Imaging ImageIO Tools on a Linux Machine"

From MircWiki
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
=== Important ===
 
=== Important ===
 
+
The binary (.bin) files at the Oracle / Sun website do not work on modern versions of the linux kernel / ubuntu / debian distros.
* This is a small part of what the script at [[Install MIRC Zn on Ubuntu Linux]] will do automatically for you.
+
* If you want to install MIRC on a Linux machine it is recommended you head the [[Install MIRC Zn on Ubuntu Linux]] page.
+
  
 
== How to install Java Advanced Imaging ImageIO Tools on Ubuntu Linux ==
 
== How to install Java Advanced Imaging ImageIO Tools on Ubuntu Linux ==
 
* Download the script
 
* Download the script
  wget http://timphillips.net/mirc/install-JAI-imageIO.txt.txt
+
  wget https://install-java-jai-imageio.googlecode.com/files/install-java-jai-imageio
* Make it executable
+
* If you are a normal user (ie not root) on ubuntu
mv ./install-JAI-imageIO.txt.txt ./install-JAI-imageIO.txt
+
  sudo bash ./install-java-jai-imageio
  chmod 777 ./install-JAI-imageIO.txt
+
* If root user
* Run the script
+
  bash ./install-java-jai-imageio
  ./install-JAI-imageIO.txt
+
  
==What the script does==
+
==What the script does (feel free to have a look before you run it)==
  
 
* Checks you're running it as root or using sudo.
 
* Checks you're running it as root or using sudo.
* Updates the Ubuntu repos.
+
* Updates the Ubuntu repos if need be.
 
* Checks which chipset you're running.
 
* Checks which chipset you're running.
* Answers the Java installation questions in advance.
+
* (If Oracle / Sun Java 6 isn't already installed)
* Installs Oracle / Sun Java.
+
** Answers the Java installation questions in advance.
 +
** Installs the default java for your distro.
 
* Downloads the appropriate JAI ImageIO files installs JAI ImageIO.
 
* Downloads the appropriate JAI ImageIO files installs JAI ImageIO.
 
===The script itself (in case you don't trust the download)===
 
 
#!/bin/bash
 
 
# Make sure only root can run our script
 
if [[ $EUID -ne 0 ]]; then
 
echo "This script must be run as root or using sudo" 1>&2
 
exit 1
 
fi
 
 
#reassure the user something is happening
 
echo 'Updating Ubuntu repositories ...'
 
 
#work in the temp folder
 
cd /var/tmp
 
 
# partner repo
 
echo deb http://archive.canonical.com/ lucid partner >>/etc/apt/sources.list.d/partner.list
 
apt-get -qq update
 
 
# preset the java answers:
 
debconf-set-selections << END
 
sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
 
sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
 
sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
 
END
 
 
#reassure the user something is happening
 
echo 'Downloading and installing required ubuntu packages ...'
 
 
# packages installed:
 
apt-get install -y -qq acpid htop unzip xauth libxtst6 sun-java6-jdk
 
 
# if a previous version is here - get rid of it
 
cd /usr/lib/jvm/java-6-sun/
 
if [ -f UNINSTALL-jai_imageio ]; then
 
echo 'Removing previous install of JAI ImageIO ...'
 
bash UNINSTALL-jai_imageio
 
fi
 
 
#work in the temp folder
 
cd /var/tmp
 
 
#reassure the user something is happening
 
echo 'Downloading JAI Image IO ...'
 
 
#check which chipset we're using
 
case $(arch) in
 
i686)
 
CHIP=i586
 
;;
 
x86_64)
 
CHIP=amd64
 
;;
 
*)
 
;;
 
esac
 
 
#download the JAI tgz file
 
# get jai binary
 
if [ -f ./jai_imageio-1_1-lib-linux-$CHIP.tar.gz ]; then
 
rm ./jai_imageio-1_1-lib-linux-$CHIP.tar.gz
 
fi
 
wget -q http://download.java.net/media/jai-imageio/builds/release/1.1/jai_imageio-1_1-lib-linux-$CHIP.tar.gz
 
 
#reassure the user something is happening
 
echo 'Installing JAI Image IO ...'
 
 
#expand the tgz and put the files where they should go (excluding UNINSTALL)
 
tar xzf ./jai_imageio-1_1-lib-linux-$CHIP.tar.gz
 
mv ./jai_imageio-1_1/*.txt /usr/lib/jvm/java-6-sun/
 
mv ./jai_imageio-1_1/lib/libclib_jiio.so /usr/lib/jvm/java-6-sun/jre/lib/$CHIP2/
 
mv ./jai_imageio-1_1/lib/*.jar /usr/lib/jvm/java-6-sun/jre/lib/ext/
 
 
#generate the UNINSTALL file - using the version that comes in the binary install
 
cat > /usr/lib/jvm/java-6-sun/UNINSTALL-jai_imageio <<DELIM
 
#!/bin/sh
 
# @(#)UNINSTALL-jai_imageio-jdk 3.1 06/05/12 16:18:39
 
# usage: UNINSTALL-jai_imageio
 
 
echo "Uninstalling Java Advanced Imaging Image I/O Tools"
 
 
rm -f *jai_imageio.txt
 
rm -f jre/lib/ext/jai_imageio.jar
 
rm -f jre/lib/ext/clibwrapper_jiio.jar
 
if [ ( `uname` = "SunOS" ) -a ( `uname -p` = "sparc" ) ]; then
 
rm -f jre/lib/sparc/libclib_jiio.so
 
rm -f jre/lib/sparc/libclib_jiio_vis.so
 
rm -f jre/lib/sparc/libclib_jiio_vis2.so
 
 
if [ -f jre/lib/sparcv9/libclib_jiio.so ]; then
 
rm -f jre/lib/sparcv9/libclib_jiio.so
 
rm -f jre/lib/sparcv9/libclib_jiio_vis.so
 
rm -f jre/lib/sparcv9/libclib_jiio_vis2.so
 
fi
 
fi
 
if [ -f jre/lib/amd64/libclib_jiio.so ]; then
 
rm -f jre/lib/amd64/libclib_jiio.so
 
fi
 
if [ -f jre/lib/i386/libclib_jiio.so ]; then
 
rm -f jre/lib/i386/libclib_jiio.so
 
fi
 
rm -f UNINSTALL-jai_imageio
 
 
echo "Done"
 
DELIM
 
 
 
  
 
<div align="right">''Any questions or comments please email me at timothy.john.phillips@gmail.com - Tim Phillips.''</div>
 
<div align="right">''Any questions or comments please email me at timothy.john.phillips@gmail.com - Tim Phillips.''</div>

Latest revision as of 22:05, 27 April 2013

1 Important

The binary (.bin) files at the Oracle / Sun website do not work on modern versions of the linux kernel / ubuntu / debian distros.

2 How to install Java Advanced Imaging ImageIO Tools on Ubuntu Linux

  • Download the script
wget https://install-java-jai-imageio.googlecode.com/files/install-java-jai-imageio
  • If you are a normal user (ie not root) on ubuntu
sudo bash ./install-java-jai-imageio 
  • If root user
bash ./install-java-jai-imageio 

3 What the script does (feel free to have a look before you run it)

  • Checks you're running it as root or using sudo.
  • Updates the Ubuntu repos if need be.
  • Checks which chipset you're running.
  • (If Oracle / Sun Java 6 isn't already installed)
    • Answers the Java installation questions in advance.
    • Installs the default java for your distro.
  • Downloads the appropriate JAI ImageIO files installs JAI ImageIO.
Any questions or comments please email me at timothy.john.phillips@gmail.com - Tim Phillips.