泥偶有一台Apple PowerBook G4 12-inch。在上面运行Debian GNU/Linux ``Sarge'' 3.1r0。
从 IBM Developer kit for Linux http://www-128.ibm.com/developerworks/java/jdk/linux140/ 上面下载最新的 IBM Java SDK。泥偶下载的是 IBM SDK for 32-bit iSeries/pSeries
版本 142 SR2,IBMJava2-SDK-142.ppc.tgz,59,738,488 字节长。
下载安装 Debian 软件包 java-package,apt-get install java-package。推荐安装 Debian 软件包 fakeroot,apt-get install fakeroot。
将下载的 IBMJava2-SDK-142.ppc.tgz 转换成 Debian 软件包。
~~~snip~~~
$ fakeroot make-jpkg IBMJava2-SDK-142.ppc.tgz
Creating temporary directory: /tmp/make-jpkg.XXXXWs7SXW
Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh ibm-j2re.sh ibm-j2sdk.sh j2re.sh j2sdk.sh j2se.sh sun-j2re.sh sun-j2sdk.sh
Detected product:
Java(TM) Software Development Kit (J2SDK)
Standard Edition, Version 1.4.2
IBM Corporation
Is this correct [Y/n]:
Checking free diskspace: done.
Please enter your full name. This value will be used in the maintainer
field of the created package.
Full name [root]:Gong, Jie
Please enter a valid email address or press return to accept the
default value. This address will be used in the maintainer field of
the created package.
Email [root@localhost.localdomain]: neo@mamiyami.com
In the next step, the binary file will be extracted. Probably a
license agreement will be displayed. Please read this agreement
carefully. If you do not agree to the displayed license terms, the
package will not be built.
Press [Return] to continue:
Testing extracted archive... okay.
Create debian package:
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_compress
find: /tmp/make-jpkg.XXXXWs7SXW/install//usr/lib/j2sdk1.4-ibm/man: No such file or directory
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package `ibm-j2sdk1.4' in `/tmp/make-jpkg.XXXXWs7SXW/ibm-j2sdk1.4_1.4.2_powerpc.deb'.
copy ibm-j2sdk1.4_1.4.2_powerpc.deb into directory /tmp/
The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i ibm-j2sdk1.4_1.4.2_powerpc.deb).
Removing temporary directory: done
~~~snip~~~
这是做好的 Debian 软件包。
~~~snip~~~
$ ls -l ibm-j2sdk1.4_1.4.2_powerpc.deb
-rw-r--r-- 1 neo neo 59694754 2005-08-29 22:59 ibm-j2sdk1.4_1.4.2_powerpc.deb
~~~snip~~~
运行 dpkg -i ibm-j2sdk1.4_1.4.2_powerpc.deb 安装新做好的软件包。
运行 /usr/lib/j2sdk1.4-ibm/demo 下面的例子来进行测试。
~~~snip~~~
$ java /usr/lib/j2sdk1.4-ibm/demo/bigdecimal/decdemo.class
0.9 0.9
0.09 0.089999996
0.009 0.0090
0.0009 9.0E-4
0.00009 9.0E-5
0.000009 9.0E-6
9E-7 9.0000003E-7
9E-8 9.0E-8
9E-9 9.0E-9
9E-10 8.9999996E-10
~~~snip~~~
初步的测试看起来一切工作正常。但是进一步的测试表明,运行稍复杂的例子时 Java 虚拟机会崩溃。
~~~snip~~~
$ java -jar /usr/lib/j2sdk1.4-ibm/demo/jfc/Java2D/Java2Demo.jar
JVMDG217: Dump Handler is Processing Signal 4 - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written to /tmp/javacore.20050829.230634.4914.txt
JVMDG215: Dump Handler has Processed Exception Signal 4.
Illegal instruction
~~~snip~~~
看!Java 虚拟机制造出非法指令,并且崩溃了。根据参考资料2,设定 JITC_PROCESSOR_TYPE 环境变量可以解决这个问题。
修改 /usr/bin/*-j2sdk1.4-ibm 一共13个文件,在每个文件中增加一行 export JITC_PROCESSOR_TYPE="6"。修改以后的13个文件看起来象下面这样。
~~~snip~~~
$ head /usr/bin/*-j2sdk1.4-ibm
==> /usr/bin/appletviewer-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/appletviewer ${1+"$@"}
==> /usr/bin/idlj-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/idlj ${1+"$@"}
==> /usr/bin/jar-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/jar ${1+"$@"}
==> /usr/bin/javac-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/javac ${1+"$@"}
==> /usr/bin/javadoc-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exe c/usr/lib/j2sdk1.4-ibm/bin/javadoc ${1+"$@"}
==> /usr/bin/javah-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/javah ${1+"$@"}
==> /usr/bin/java-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/java ${1+"$@"}
==> /usr/bin/javap-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/javap ${1+"$@"}
==> /usr/bin/jdb-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/jdb ${1+"$@"}
==> /usr/bin/rmic-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/rmic ${1+"$@"}
==> /usr/bin/rmid-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/rmid ${1+"$@"}
==> /usr/bin/rmiregistry-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/rmiregistry ${1+"$@"}
==> /usr/bin/serialver-j2sdk1.4-ibm <==
#! /bin/sh
export JITC_PROCESSOR_TYPE="6"
exec /usr/lib/j2sdk1.4-ibm/bin/serialver ${1+"$@"}
~~~snip~~~
修改完后重新运行这个测试, java -jar /usr/lib/j2sdk1.4-ibm/demo/jfc/Java2D/Java2Demo.jar 即可顺利工作。
参考资料
1. IBM Developer Kit for Linux?, Java? 2 Technology Edition
http://www-128.ibm.com/developerworks/java/jdk/linux140/
2. 用于 Apple PowerPC 硬件上的 IBM Java 开发工具
http://www-128.ibm.com/developerworks/cn/linux/l-pow-apple.html
3. No Free Java Plugin for Mozilla (at the moment)
http://people.debian.org/~avdyk/no_free_java_plugin_for_mozilla.html