2014年2月28日 星期五
Ubuntu Install Tomcat (src)
1. Install JDK
reference here:
http://csw-dawn.blogspot.tw/2014/02/ubuntu-java-jdk.html
2. Download tomcat7
https://tomcat.apache.org/download-70.cgi
3. $ tar zxvf apache-tomcat-7.0.52.tar.gz
4. $ sudo cp -r apache-tomcat-7.0.52 /usr/local/tomcat7
5. $ cd /usr/local/tomcat7/lib
6. $ sudo cp servlet-api.jar jsp-api.jar el-api.jar /usr/lib/jdk/jdk1.7.0_51/jre/lib/ext/
7. Install mysql-connector-java
$ sudo cp mysql-connector-java-5.1.22-bin.jar /usr/local/tomcat7/lib/
8. $ sudo vim /etc/rc.local
Add : sudo sh /usr/local/tomcat7/bin/startup.sh
2014年2月20日 星期四
Java 使用 Apache POI
1. Download page
http://poi.apache.org/download.html
to download poi-bin-3.10-FINAL-20140208.tar.gz
2. 解壓縮
3. 打開 Eclipse
在 Project 上按右鍵
Properties->Java Build Path->Libraries->Add JARs
選擇 poi-3.10-FINAL-20140208.jar 檔加入
4. 開始使用
http://poi.apache.org/download.html
to download poi-bin-3.10-FINAL-20140208.tar.gz
2. 解壓縮
3. 打開 Eclipse
在 Project 上按右鍵
Properties->Java Build Path->Libraries->Add JARs
選擇 poi-3.10-FINAL-20140208.jar 檔加入
4. 開始使用
Ubuntu Install Tomcat
1. Install Tomcat
$ sudo apt-get install tomcat7
2. Check Status
$ sudo /etc/init.d/tomcat7 status
* Tomcat servlet engine is running with pid 13249
3. Install mysql-connector-java
$ sudo cp mysql-connector-java-5.1.22-bin.jar /usr/share/tomcat7/lib/
4. Restart Tomcat
$ sudo /etc/init.d/tomcat7 restart
* Stopping Tomcat servlet engine tomcat7 [ OK ]
* Starting Tomcat servlet engine tomcat7 [ OK ]
5. Test
$ cd /var/lib/tomcat7/webapps/ROOT
$ sudo vim test1.jsp
test1.jsp:
<%
out.println("Hello World!");
%>
6. Open browser
http://<your_server_ip_address>:8080/test1.jsp
will show
Hello World!
7. cd /usr/share/tomcat7/lib
8. $ sudo cp servlet-api.jar jsp-api.jar el-api.jar /usr/lib/jdk/jdk1.7.0_51/jre/lib/ext/
$ sudo apt-get install tomcat7
2. Check Status
$ sudo /etc/init.d/tomcat7 status
* Tomcat servlet engine is running with pid 13249
3. Install mysql-connector-java
$ sudo cp mysql-connector-java-5.1.22-bin.jar /usr/share/tomcat7/lib/
4. Restart Tomcat
$ sudo /etc/init.d/tomcat7 restart
* Stopping Tomcat servlet engine tomcat7 [ OK ]
* Starting Tomcat servlet engine tomcat7 [ OK ]
5. Test
$ cd /var/lib/tomcat7/webapps/ROOT
$ sudo vim test1.jsp
test1.jsp:
<%
out.println("Hello World!");
%>
6. Open browser
http://<your_server_ip_address>:8080/test1.jsp
will show
Hello World!
7. cd /usr/share/tomcat7/lib
8. $ sudo cp servlet-api.jar jsp-api.jar el-api.jar /usr/lib/jdk/jdk1.7.0_51/jre/lib/ext/
2014年2月19日 星期三
Ubuntu 安裝 Java JDK
1. 先到 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
下載 jdk
2. 解壓縮
$ tar zxvf jdk-7u51-linux-i586.tar.gz
3. 建立jdk目錄
$ sudo mkdir /usr/lib/jdk
4. Copy jdk 到 /usr/lib 目錄下
$ sudo cp -r jdk1.7.0_51 /usr/lib/jdk
5. 設定環境變數
$ sudo vim /etc/profile
加上以下內容:
export JAVA_HOME=/usr/lib/jdk/jdk1.7.0_51
export JRE_HOME=/usr/lib/jdk/jdk1.7.0_51/jre
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
6. 置換系統默認 jdk
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.7.0_51/bin/java 300
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.7.0_51/bin/javac 300
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
7. 確認安裝
$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode)
下載 jdk
2. 解壓縮
$ tar zxvf jdk-7u51-linux-i586.tar.gz
3. 建立jdk目錄
$ sudo mkdir /usr/lib/jdk
4. Copy jdk 到 /usr/lib 目錄下
$ sudo cp -r jdk1.7.0_51 /usr/lib/jdk
5. 設定環境變數
$ sudo vim /etc/profile
加上以下內容:
export JAVA_HOME=/usr/lib/jdk/jdk1.7.0_51
export JRE_HOME=/usr/lib/jdk/jdk1.7.0_51/jre
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
6. 置換系統默認 jdk
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk/jdk1.7.0_51/bin/java 300
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk/jdk1.7.0_51/bin/javac 300
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
7. 確認安裝
$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode)
8. 完成
訂閱:
文章 (Atom)