Download presentation
Presentation is loading. Please wait.
Published byJustina King Modified over 9 years ago
1
在 FreeBSD 中打造 JSP 環 境與 java application 的 概念 JDK1.4+Tomcat J2 sdk
2
FreeBSD Ports: Java jdk-1.4.2p6_4 jdk-1.4.2p6_4 http://www.freebsd.org/cgi/cvsweb.cgi/ports/j ava/jdk14/jdk14.tar.gz?tarball=1 http://www.freebsd.org/cgi/cvsweb.cgi/ports/j ava/jdk14/jdk14.tar.gz?tarball=1 http://www.freebsd.org/cgi/cvsweb.cgi/ports/j ava/jdk14/jdk14.tar.gz?tarball=1 Requires: XFree86-libraries-4.3.0_7, expat- 1.95.7, fontconfig-2.2.3,1, freetype2-2.1.7_3, gettext-0.13.1_1, gmake-3.80_2, imake- 4.3.0_2, javavmwrapper-1.5, libiconv-1.9.2, linux-sun-jdk-1.4.2.05, linux_base-7.1_7, m4-1.4_1, nspr-4.4.1_1, open-motif-2.2.2_2, perl-5.8.4, pkgconfig-0.15.0_1, urwfonts-1.0, zip-2.3_1 XFree86-libraries-4.3.0_7expat- 1.95.7fontconfig-2.2.3,1freetype2-2.1.7_3 gettext-0.13.1_1gmake-3.80_2imake- 4.3.0_2javavmwrapper-1.5libiconv-1.9.2 linux-sun-jdk-1.4.2.05linux_base-7.1_7 m4-1.4_1nspr-4.4.1_1open-motif-2.2.2_2 perl-5.8.4pkgconfig-0.15.0_1urwfonts-1.0 zip-2.3_1XFree86-libraries-4.3.0_7expat- 1.95.7fontconfig-2.2.3,1freetype2-2.1.7_3 gettext-0.13.1_1gmake-3.80_2imake- 4.3.0_2javavmwrapper-1.5libiconv-1.9.2 linux-sun-jdk-1.4.2.05linux_base-7.1_7 m4-1.4_1nspr-4.4.1_1open-motif-2.2.2_2 perl-5.8.4pkgconfig-0.15.0_1urwfonts-1.0 zip-2.3_1 Cp –R distfiles /usr/ports/
3
JDK1.4 安裝程序 (1/2): 1. 安裝 ports/java/linux-sun-jdk14 # cd /usr/ports/linux-sun-jdk14 # make install 2. 手動設定 linux-sun-jdk14 的執行環境 在 /etc/fstab 中加入 linprocfs /compat/linux/proc linprocfs rw 0 0 linprocfs /compat/linux/proc linprocfs rw 0 0 root 執行 # kldload linprocfs # mount /compat/linux/proc # mount /compat/linux/proc
4
JDK1.4 安裝程序 (2/2): 3. 安裝 ports/java/jdk14 # cd /usr/ports/java/jdk14 #make install 4. 後續設定 在 /etc/rc.conf 中加入 linux_enable="YES"
5
tomcat 安裝程序 :binary binary http://apache.cdpa.nsysu.edu.tw/jakarta/tom cat-5/v5.0.27/bin/jakarta-tomcat- 5.0.27.tar.gz http://apache.cdpa.nsysu.edu.tw/jakarta/tom cat-5/v5.0.27/bin/jakarta-tomcat- 5.0.27.tar.gz http://apache.cdpa.nsysu.edu.tw/jakarta/tom cat-5/v5.0.27/bin/jakarta-tomcat- 5.0.27.tar.gz # tar xvfz jakarta-tomcat-5.0.27.tar.gz #mv jakarta-tomcat-5.0.27 tomcat
6
環境變數的設定 在 root 的 bash 設定檔.profile 中加入 JAVA_HOME=/usr/local/jdk1.4.2/ PATH=/usr/local/jdk1.4.2/bin/:$PATH CLASSPATH=/usr/local/share/java/classes/:/usr/loc al/jdk1.4.2/lib/:/usr/local/jdk1.4.2/tools.jar export JAVA_HOME PATH CLASSPATH CATALINA_HOME=/usr/local/jakarta-tomcat5.0/ TOMCAT_HOME=/usr/local/jakarta-tomcat5.0/ PATH=/usr/local/jakarta-tomcat5.0/bin:$PATH
7
Tomcat 啟動程序 : 設定 sysctl -w net.inet6.ip6.v6only=0 或在 /etc/sysctl.conf 加入 net.inet6.ip6.v6only=0 於開機時自動關閉 net.inet6.ip6 # /usr/local/tomcat/bin/startup.sh 連線測試 http://163.27.230.40:8080
8
Jsp 範例 (1/2)index.html 輸入資料的表單 輸入資料的表單 姓名: 姓名: 興趣: 興趣:
9
Jsp 範例 (2/2) echo.jsp 輸入資料 輸入資料 <% String name = request.getParameter("name"); String hobby = request.getParameter("hobby"); out.print( name + " ,你喜歡 " + hobby + " 。 "); %>
10
Java(TM) 2 SDK, Standard Edition 1.4.2_05 下載網址 https://sdlcweb1b.sun.com/ECom/EComActionServlet/ LegalPage:~:com.sun.sunit.sdlc.content.LegalWebPag eInfo;jsessionid=sdlcweb1b.sun.com- 74c3%3A41125fbb%3A9b547aa38b773531 https://sdlcweb1b.sun.com/ECom/EComActionServlet/ LegalPage:~:com.sun.sunit.sdlc.content.LegalWebPag eInfo;jsessionid=sdlcweb1b.sun.com- 74c3%3A41125fbb%3A9b547aa38b773531 https://sdlcweb1b.sun.com/ECom/EComActionServlet/ LegalPage:~:com.sun.sunit.sdlc.content.LegalWebPag eInfo;jsessionid=sdlcweb1b.sun.com- 74c3%3A41125fbb%3A9b547aa38b773531 For windows 版本下載 http://192.18.97.45/ECom/EComTicketServlet/BEGINs dlcweb1b.sun.com- 74c3%3A41125fbb%3A9b547aa38b773531/- 2147483648/472144287/1/489890/489662/472144287/ 2ts+/westCoastFSEND/j2sdk-1.4.2_05-oth-JPR/j2sdk- 1.4.2_05-oth-JPR:2/j2sdk-1_4_2_05-windows-i586- p.exe
11
Java Application 環境設定 (1/2) 控制台 -> 系統 -> 進階 -> 環境變數 -> 新增 變數名稱 CLASSPATH CLASSPATH 變數值 D:\j2sdk1.4.0.03;D:\j2sdk1.4.0.03\mysql- connector-java-3.0.11-stable;.;
12
Java Application 環境設定 (2/2) 控制台 -> 系統 -> 進階 -> 環境變數 變數名稱 path path 變數值 D:\j2sdk1.4.0.03\bin
13
Java application 範例 import java.awt.*; import java.awt.event.*; public class HelloWorldFrame extends java.awt.Frame { public static void main(String args[]){ new HelloWorldFrame(); } // 建構函式 public HelloWorldFrame() { super("Hello World"); this.setSize(200, 200); this.show(); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public void paint(Graphics g) { g.drawString("Hello World Frame", 50, 50); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.