Hardware and Software Environment
ubuntu12.04+jdk1.7+eclipse+tomcat7.0
Table of Contents
1. Install JDK1.7, configure the Java environment
2. Install Eclipse
3. Installing Tomcat7.0
1. Install JDK1.7, configure the Java environment
Step 1: Download the JDK
Step 2: Unzip into the/usr/local
sudo tar-zxvf jdk-7u67-linux-x64.tar.gz-c/usr/local
Step 3: Configure environment variables
Open/etc/profile file: sudo gedit/etc/profile
Increase on the last side of the file:
Export java_home=/usr/lib/jvm/jdk1.7.0_67
Export path= #PATH: $JAVA _home/bin: $JAVA _home/jre/bin
Export classpath= $CLASSPATH:.: $JAVA _home/lib/tools.jar: $JAVA _home/jre/lib/dt.jar
When configuring path and classpath, be careful to add the original path and classpath as shown above.
Configure the environment variables, you can restart, the easier way is to source/etc/profile.
Finally, use Javac and Java to see if the environment variable is installed successfully.
Java-version
Javac-version
2. Install Eclipse
Step 1: Download eclipse
Step 2: Unzip Eclipse to/opt
sudo tar-zxvf eclipse-jee-luna-r-linux-gtk-x86_64.tar.gz-c/opt
Step 3: Create a command-line startup script for Eclipse
Create a startup script in the/usr/bin directory eclipse
sudo vim/usr/bin/eclipse
Then add the following to the file:
#!/bin/sh
Export Eclipse_home= "/home/opt/eclipse"
#使root用户的环境变量生效
Source/etc/profile
$ECLIPSE _home/eclipse $*
Modify the permissions of the script to make it executable and execute the following command:
sudo chmod +x/usr/bin/eclipse
3. Installing Tomcat7.0
Step 1: Download tomcat
Step 2: Unzip tomcat7.0 to/opt
sudo tar-zxvf apache-tomcat-7.0.55.tar.gz-c/opt
Step 3: Setup Environment Variables
sudo vi/etc/profile
At the bottom, add:
Export catalina_home=/opt/apache-tomcat7.0.40
Make it effective
Source/etc/profile
Step 4: Modify catalina.sh
CD $CATALINA _home/bin
sudo vim catalina.sh
Find the # OS specific support. $var _must_ is set to either true or false line
Define again Catalina_home and java_home on this:
catalina_home=/opt/apache-tomcat7.0.55
java_home=/usr/local/jdk1.7.0_67
Save exit
Step 5: Try to start tomcat
sudo./bin/startup.sh
If the following is displayed without any exceptions, the startup succeeds:
Using catalina_base:/opt/apache-tomcat7.0.55
Using Catalina_home:/opt/apache-tomcat7.0.55
Using Catalina_tmpdir:/opt/apache-tomcat7.0.55/temp
Using Jre_home:/usr/local/java/jdk1.7.0_67
Using CLASSPATH:/opt/apache-tomcat7.0.55/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Step 6: Stop Tomcat
sudo./bin/shutdown.sh
Step 7: Open the Default Web page to see if Tomcat is working properly
http://localhost:8080
Ubuntu12.04 Configuring the Java Development environment: jdk1.7+eclipse+tomcat7.0