在ubuntu上部署JDK+Tomcat+Mysql+eclipse详解

1、安装JDK:

$sudo tar xzvf jdk-7u4-linux-i586.tar.gz -C /usr/local/
cd /usr/local/
$sudo ln -s jdk1.7.0_04/ jdk1.7

修改配置文件/etc/profile,添加环境变量:

export JAVA_HOME=/usr/local/jdk1.7 
export JRE_HOME=${JAVA_HOME}/jre 
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib 
export PATH=${JAVA_HOME}/bin:$PATH

测试,会显示出JDK的版本信息:

java �Cversion


2、安装Tomcat:

sudo tar xzvf apache-tomcat-7.0.30.tar.gz  -C /usr/local/
cd /usr/local/
sudo ln -sv apache-tomcat-7.0.30/ tomcat

启动:

sudo bin/catalina.sh start

我在启动时,报以下错误信息:

Neitherthe JAVA_HOME nor the JRE_HOME environment variable is defined

At least one of these environment variable is needed to run this program

解决方法:

修改配置文件setclasspath.sh,添加环境变量:

sudo vim bin/setclasspath.sh
    export JAVA_HOME=/usr/local/jdk1.7
    export JRE_HOME=/usr/local/jdk1.7/jrediq

启动结果:

$ sudo bin/catalina.sh start
Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/local/jdk1.7/jre
Using CLASSPATH:       /usr/local/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.30/bin/tomcat-juli.jar侧首
测试,显示出来tomcat的界面,即成功:

http://192.168.6.233:8080

添加用户:

编辑tomcat-users.xml添加如下内容:
vim /usr/local/tomcat/conf/tomcat-users.xml
  <role rolename="manager-gui"/>
  <user username="tomcat" password="s3cret" roles="manager-gui"/>


3、安装Mysql:

sudo apt-get install libmysql-java mysql-server-5.5

中间会提示:让输入数据库密码。


4、安装ecplise:

sudo tar zxvf eclipse-jee-juno-SR2-linux-gtk.tar.gz -C /usr/local
cd /usr/local/eclipse

测试:

sudo ./eclipse

此时报错,显示:

Eclipse:

A Java Runtime Environment (JRE) or Java Development Kit (JDK)

must be available in order to run Eclipse. No Java virtual machine

was found after searching the following locations:

/usr/local/eclipse/jre/bin/java

java in your current PATH

解决方法:

sudo /usr/local/eclipse/eclipse -vm /usr/local/jdk1.7/bin/                  #指定/usr/local/jdk1.7/bin启动

但是,此时又报错:

Can't load library: /root/.swt/lib/linux/x86/libswt-pi-gtk-4236.so

Can't load library: /root/.swt/lib/linux/x86/libswt-pi-gtk.so

解决方法:

apt-get install libswt-gtk-3-jni libswt-gtk-3-java

再次启动:

sudo /usr/local/eclipse/eclipse -vm /usr/local/jdk1.7/bin/
OK!!!


你可能感兴趣的:(jdk,tomcat,安装,ecplise)