Howto Install Java, Tomcat, Netbeans
The installation will take place via the terminal (go to the menu select Applications->Accessories->Terminal)
NB: Do NOT Log in as root
Once the terminal loads, we can start.
Add the repository by issuing the following line to the terminal;
sudo add-apt-repository ppa:sun-java-community-team/sun-java6
Then run an update of ubuntu
sudo apt-get update
Now we install the required packages
sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-jre sun-java6-plugin sun-java6-fonts
Test that Java is installed and what version by issuing the following command
Get the path to JDK/JRE install folder. Test if JAVA_HOME is set
If set, it could be something like /usr/lib/jvm/java-X.Y.Z-sun-X.Y.Z
At the command prompt, type (NOTE YOU NEED TO GIVE THE PATH TO YOUR JAVA, the one below is just in my case and may differ)
If interested, you could also install the following as explained below;
2. Netbeans (You definately need this)
Spring is a popular and widely deployed open source framework that helps developers build high quality applications faster. Spring provides a consistent programming and configuration model that is well understood and used by millions of developers worldwide (Source:springsource.com).
Go to http://www.springsource.com/downloads and download
Download SpringSource Tool Suite – pick the .sh
Following the download, Open the terminal, and navigate to the directory it was installed in, then type the following to install
A prompt will load, just use the default settings and remember to accept the license agreement (no option)
Prerequisite: Sun Java JDK installed
1. Download NetBeans 6.9 from NetBeans download page (select the version you want)
2. Once you have downloaded Open a terminal window and navigate to your Download directory (where you downloaded NetBeans installer script). Once you are at your download directory, type the following command to begin the installation.
Check this great url
Now you should be all ready to try tomcat7.
First we must lift the server with the following command:
With this we get the following output on console:
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using JRE_HOME: /usr/local/jdk1.6.0_20/jre
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Verify that the JRE_HOME is where we define.
Now open your web browser and type the following url:
So we get the following page:
If we enter the administration Tomcat Manager we click on the menu or directly at URL (See – “Setting Tomcat password and permissions” section below):
Here we ask the user data from previous record in mind tomcat-users.xml.
I recommend testing the sample to make sure everything works ok, they are in the section “Miscellaneous” from the side menu or at the URL:
To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.
sudo gedit /etc/init.d/tomcat7
Now paste in the following:
# Tomcat auto-start
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
You’ll need to make the script executable by running the chmod command:
sudo chmod 755 /etc/init.d/tomcat7
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.
sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat
Tomcat should now be fully installed and operational. Enjoy!
sudo /etc/init.d/tomcat7 restart
Setting Tomcat password and permissions
On the terminal (logged in as root), go to the Tomcat directory, in my case its
Then move into the conf directory
Edit the tomcat-users.xml file
Add the following line just before the closing tomcat-users xml tag ( tomcat-users )
<user password=”tomcat” roles=”tomcat,role1″ username=”both”/>
<user password=”tomcat” roles=”role1″ username=”role1″/>
<user password=”tomcat” roles=”admin-gui,manager-gui,manager,admin” username=”tomcat”/>
Restart tomcat (ensure that the path to tomcat is correct in your case)
The default Tomcat username and password will now be tomcat
Add Apache Tomcat as a server in Netbeans
NB: Note that Apache tomcat does not appear on netbeans when you are creating a Java Web project.
You can fix this by going to Netbeans Tools->Servers
You can then select the tomcat version that is presently installed and save.