Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I new in the ubuntu and i install java in this using oracle VM virtual box. I download jdk after what doing for java install and than after install apache tomcat 7. please help me both software install in ubuntu. Thanks .

share|improve this question
1  
Did you see this: askubuntu.com/questions/56104/… and askubuntu.com/questions/338795/… –  Jobin Dec 30 '13 at 6:06
add comment

1 Answer

up vote 1 down vote accepted

1- Install Sun JRE 7

Download the sun jre 7 tar file

Extract the tar file:

tar -xvzf jre-7u4-linux-x64.tar.gz

Move extracted folder to this location:

sudo mv jre1.7.0_04 /usr/lib/jvm/

Install new java source in system:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_04/bin/java 1

Choose default java:

sudo update-alternatives --config java

java version test:

java -version

Verify the symlinks all point to the new java location:

ls -la /etc/alternatives/java*

2- Install Sun JDK 7

Download the sun jdk 7 tar file

Extract the tar file:

tar -xvzf jdk-7u4-linux-x64.tar.gz

Move extracted folder to this location:

sudo mv jdk1.7.0_04 /usr/lib/jvm/

Install new java source in system:

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1

sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1

sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_04/bin/jar 1

Choose default java:

sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws

java version test:

java -version

Verify the symlinks all point to the new java location:

ls -la /etc/alternatives/java*

3- Install Tomcat

to install tomcat easily

sudo apt-get install tomcat7

4- Autostart Tomcat when booting

Create the init script in /etc/init.d/tomcat7

#!/bin/bash

PATH=/sbin:/bin:/usr/sbin:/usr/bin

start() {
 sh /usr/share/tomcat7/bin/startup.sh
}

stop() {
 sh /usr/share/tomcat7/bin/shutdown.sh
}

case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac

Change its permissions and add the correct symlinks automatically:

chmod 755 /etc/init.d/tomcat7
update-rc.d tomcat7 defaults

And from now on it will be automatically started and shut down upon entering the appropriate runlevels.

share|improve this answer
    
i using oracle virtualbox terminal for ubuntu than how jre7 download and extract in this. –  Iren Patel Dec 30 '13 at 8:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.