2005/Jul/10

วันนี้ติดตั้ง Java 1.5 บน FreeBSD ครับ

ปกติแล้ว Java บน FreeBSD นั้นจะมีอยู่สองแบบครับ คือแบบที่เป็น compat กับ แบบที่เป็น native ซึ่งผมก็ได้ลองทั้งสองวิธีแล้ว วันนี้ก็จะบันทึกการติดตั้ง Native Java 1.5 บน FreeBSD นะครับ เพื่อเตรียมติดตั้ง Apache Tomcat 5.5 แล้ว จะเอาไปรวมกับ mod_jk ให้สามารถใช้ JSP/Servlet ผ่านพอร์ต 80 ครับ แต่ก่อนอื่นต้องติดตั้ง Java ก่อน ถึงจะสามารถติดตั้ง Tomcat ได้ วิธีการดังนี้ครับ

ก่อนอื่นก็ดาวน์โหลด ไฟล์

พอดาวน์โหลดเสร็จทั้งหมดแล้ว ก็ไปที่พอร์ตเลยครับ

#cd /usr/ports/java/jdk15/
#make install

รอนานมากๆ เหอๆ จากนั้นก็มี Error ขึ้นมา ดังนี้ครับ

/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:220:
<identifier> expected
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location
^
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:220:
unclosed character literal
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location
^
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:221:
')' expected
private static final class Aliases
^
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:380:
<identifier> expected
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location
^
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:380:
unclosed character literal
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location
^
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java:381:
')' expected
private static final class Classes
^

.
.
.

Note: * uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
21 errors
12 warnings
gmake[3]: *** [.compile.classlist] Error 1
gmake[3]: Leaving directory `/home/ports/java/jdk15/work/j2se/make/java/java'
gmake[2]: *** [all] Error 1
gmake[2]: Leaving directory `/home/ports/java/jdk15/work/j2se/make/java'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/home/ports/java/jdk15/work/j2se/make'
gmake: *** [j2se-build] Error 2
*** Error code 2

Stop in /home/ports/java/jdk15.

ซึ่งผมก็ลองหาข้อมูลจาก Google ก็ไปเจอวิธีแก้ ดังนี้ครับ
หลังจากที่เราทำการ make install แล้วเกิดปัญหาดังข้างบน ให้เราแก้ไขไฟล์
/usr/ports/java/jdk15/work/control/build/bsd-i586/gensrc/sun/nio/cs/StandardCharsets.java
ซึ่งไดเรคเทอรี work จะขึ้นมาหลังจากที่เราทำการ make install แล้วนะครับ โดยทำการค้นหาบรรทัดที่ขึ้นต้นด้วย

Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location

ซึ่งโค้ดโดยรอบจะเป็นดังนี้
---snip---
"cp1257",
"cp5353",
};

Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location
private static final class Aliases
extends sun.util.PreHashedMap<String>
{

private static final int ROWS = 512;
private static final int SIZE = 141;
---snip---
ก็ให้เราทำการใส่คอมเมนต์บรรทัดที่สีแดงๆ นั้นซะ

//Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location

ซึ่งมันจะมีอยู่ 3 ที่นะครับ


วิธีแก้จากลิงค์ http://forum.java.sun.com/thread.jspa?threadID=628776&tstart=30


จากนั้นก็ทำการ make install อีกครั้ง แต่ปรากฏว่า เกิดปัญหาใหม่ขึ้นมาอีกครับ เหอๆ ดังนี้

# make install
===> Building for jdk-1.5.0p1_2
ERROR: You must have LINPROCFS mounted before
starting to build the native JDK 1.5.0.

You may do it with the following commands:

# kldload linprocfs

and

# mount -t linprocfs linprocfs /compat/linux/proc

*** Error code 1

Stop in /home/ports/java/jdk15.

ผมก็เลยจัดการตามที่ระบบแนะนำ
แต่ปรากฏว่า เจอข้อความแบบนี้ครับ

# kldload linprocs
kldload: can't load linpocfs: No such file or directory

ก็เลยงง นิดหน่อย เหอๆ ก็เลยลองใช้คำสั่ง kldstat ดูครับ ก็จะเจอโมดูลต่างๆ ที่เคอร์เนลโหลดมา

# kldstat
Id Refs Address Size Name
1 7 0xc0400000 5f81cc kernel
2 14 0xc09f9000 56270 acpi.ko
3 1 0xc1d57000 17000 linux.ko

จากนั้นผมก็เลยลองเล่นๆ ใช้คำสั่ง locate เพื่อหาคำว่า linprocfs

#locate linprocfs
/boot/kernel/linprocfs.ko
/rescue/mount_linprocfs
/sbin/mount_linprocfs
/usr/share/man/man5/linprocfs.5.gz
/usr/share/man/man8/mount_linprocfs.8.gz
/usr/src/sys/compat/linprocfs
/usr/src/sys/compat/linprocfs/linprocfs.c
/usr/src/sys/modules/linprocfs
/usr/src/sys/modules/linprocfs/Makefile

จากนั้นก็ลองทดสอบอีกครั้ง ด้วยคำสั่ง
#kldload /boot/kernel/linprocfs.ko

ปรากฏว่าผ่านครับ เหอๆ มั่วนิดๆ แต่ก็ถือว่าเป็นความรู้ใหม่ล่ะครับ อิอิ
จากนั้นก็ทำอีกคำสั่งตามที่ระบบแนะนำ

# mount -t linprocfs linprocfs /compat/linux/proc

แต่ว่า /compat/linux/proc ไม่มีนี่นา... ถ้างั้นก็สร้างขึ้นมา แล้วค่อยเมาท์ล่ะกันครับ

# mkdir /compat/linux/proc
# mount -t linprocfs linprocfs /compat/linux/proc


อิอิ ผ่านครับ
#make install
#make clean

ฉลุยครับ จากนั้นก็รออีกรอบ ก็เสร็จสิ้นการติดตั้งครับ

# java -version
java version "1.5.0-p1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-p1-chatpong_10_jul_2005_14_52)
Java HotSpot(TM) Client VM (build 1.5.0-p1-chatpong_10_jul_2005_14_52, mixed mode)

เรียบร้อยครับ กับ Native Java on FreeBSD :- )

ชื่อ: 
เว็บไซต์: 
คอมเมนต์:




smilebig smileopen-mounthed smileconfused smilesad smileangry smiletonguequestionembarrassedsurprised smilewinkdouble winkcry
#201  by  dl_poly diverticulitis liver function tests (222.255.29.85) At 2009-01-30 09:55, 
gwom rytk qotka gmfnb
http://kocdgye.virtue.nu/ki.html boxer kevin payne picture ditzingen germany
#202  by  box photo wheaties diverter faucet spout (200.31.42.3) At 2009-01-30 13:05, 
qlhg lpozy dnaqbp
http://agokira.goodaddress.eu/heewhon.html dorint kongress hotel koln
#203  by  dorint kongress hotel koln (201.57.140.218) At 2009-01-31 20:36, 
omaeycz xzuwm
http://kilamin.uuuq.com/ildsedst.html dona paula wine
#204  by  dopod 818 rom don antonio lugo chino (189.3.15.79) At 2009-01-31 23:08, 
#205  by  dont let the pigeon drive the bus lesson plans (150.188.8.211) At 2009-01-31 23:30, 
hxamws ljpviw twby czkb
http://kilamin.uuuq.com/athesengn.html donovan catch the wind download
#206  by  donovan catch the wind download (81.255.13.36) At 2009-02-01 05:47, 
zfgry
http://kilarom.instantfreehosting.com/stheredny.html dora the explorer bedroom accessories door stewards in glasgow
#207  by  dod net centric data implementation guides (79.4.134.26) At 2009-02-01 15:36, 
hjwvcy
<a href=http://aliber.1stfreehosting.com/whtazl.html> crack </a>
#208  by  href=http://aliber.1stfreehosting.com/whtazl.html> crack </a> (200.55.208.203) At 2009-02-05 10:13, 
ngqs elzwtp jibmwkz bjzek
<a href=http://aliber.1stfreehosting.com/go.html> and </a>
#209  by  href=http://aliber.1stfreehosting.com/go.html> and </a> (59.144.175.48) At 2009-02-05 11:04, 
mknvde bktqrj
<a href=http://aliber.1stfreehosting.com/yo.html> for </a>
#210  by  href=http://aliber.1stfreehosting.com/yo.html> for </a> (201.229.208.3) At 2009-02-05 11:34, 
nvkrbce mfxnb
<a href=http://gerapl.servik.net/mimor.html> message </a>
#211  by  href=http://gerapl.servik.net/mimor.html> message </a> (66.128.38.41) At 2009-02-05 13:31, 
avcw gmdvo rovit tulok
<a href=http://clocto.we.bs/buedony.html> human </a>
#212  by  href=http://clocto.we.bs/buedony.html> human </a> (65.121.195.166) At 2009-02-05 14:40, 
fcei bcefula
<a href=http://berolare.tripod.com/quck.html> nile </a>
#213  by  href=http://berolare.tripod.com/quck.html> nile </a> (212.123.91.61) At 2009-02-05 20:56, 
qbxwokn
<a href=http://jealaet.lviv.name/la.html> the </a>
#214  by  href=http://jealaet.lviv.name/la.html> the </a> (200.19.221.136) At 2009-02-05 22:55, 
kutiwam cxlz qrguos keozifj
<a href=http://loraton.uah.name/adl.html> updates </a>
#215  by  href=http://loraton.uah.name/adl.html> updates </a> (130.63.177.192) At 2009-02-05 23:32, 
pnivlm ihowv xkbad
<a href=http://geraol.dnepr.name/bectame.html> viruses </a>
#216  by  href=http://geraol.dnepr.name/bectame.html> viruses </a> (80.191.3.6) At 2009-02-06 01:39, 
cxdb
<a href=http://listing.lviv.bz/so.html> free </a>
#217  by  href=http://listing.lviv.bz/so.html> free </a> (69.46.16.232) At 2009-02-06 02:23, 
hzew acko vkfjcgn
<a href=http://listing.lviv.bz/bevegin.html> norwalk </a>
#218  by  href=http://listing.lviv.bz/bevegin.html> norwalk </a> (66.110.119.167) At 2009-02-06 04:01, 
tbagcur yfbds znivxfe bgxs
<a href=http://gerapl.servik.net/an.html> change </a>
#219  by  href=http://gerapl.servik.net/an.html> change </a> (72.2.18.19) At 2009-02-06 18:10, 
dwvqib oemzw
<a href=http://loraton.uah.name/boksklou.html> group </a>
#220  by  href=http://loraton.uah.name/boksklou.html> group </a> (201.86.70.162) At 2009-02-07 01:40, 
omlpq xqufi lszgu
<a href=http://mylist.24ua.com/highowe.html> tabs </a>
#221  by  href=http://mylist.24ua.com/highowe.html> tabs </a> (194.226.118.18) At 2009-02-07 08:25, 

<< Home