Home | Mirror | Search

第 42 章 Java

目錄

1. 安裝 JDK
1.1. HeapDumpOnOutOfMemoryError
2. Build Tools
2.1. Apache Ant
2.2. Apache Ivy
2.2.1. Ivy Install
2.2.1.1. source code
2.2.1.2. apt-get
2.2.2. Test example
2.3. maven2
3. API
3.1. log4j
3.2. java memcached client
3.3. Hessian

1. 安裝 JDK

解壓

chmod +x jdk-6u1-linux-i586.bin
./jdk-6u1-linux-i586.bin
輸入"yes"回車

mv jdk1.6.0_01 /usr/local/
ln -s /usr/local/jdk1.6.0_01/ /usr/local/java
	

/etc/profile.d/java.sh

例 42.1. /etc/profile.d/java.sh

################################################
### Java environment by neo
################################################
export JAVA_HOME=/usr/local/java
export JRE_HOME=/usr/local/java/jre
export PATH=$PATH:/usr/local/java/bin:/usr/local/java/jre/bin
export CLASSPATH="./:/usr/local/java/lib:/usr/local/java/jre/lib:/usr/local/memcached/api/java"
export JAVA_OPTS="-Xms128m -Xmx1024m"
		

1.1. HeapDumpOnOutOfMemoryError

JAVA_OPTS = "$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
		

如果針對Tomcat可以在catalina.sh加入

if [ "$1" = "debug" ] ; then
JAVA_OPTS = "$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
		
comments powered by Disqus