MacのJavaはServer VMしかない?
Macでjavaを起動してみるとjava6の64ビット版なServer VMが起動する。
MyMac:~ chcoopu$ which java /usr/bin/java MyMac:~ chcoopu$ java -version java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode) MyMac:~ chcoopu$
32ビット版Client VMを指定して起動しようとしても64ビット版Server VMが起動する。
MyMac:~ chcoopu$ java -d32 -client -version Cannot run Java in 32 bit mode. Continuing in 64 bit mode. java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode) MyMac:~ chcoopu$
ほかも調べてみると、
32ビット | Client VM | × |
64ビット | Client VM | × |
32ビット | Server VM | × |
64ビット | Server VM | ○ |
javaのヘルプをみると32ビットと64ビット、Client VMとServer VM両方あるように見えるのだけど
MyMac:~ chcoopu$ java -help Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available (implies -server, only for x86_64) -client to select the "client" VM -server to select the "server" VM -jvm is a synonym for the "client" VM [deprecated] -hotspot is a synonym for the "client" VM [deprecated] The default VM is client. ( 〜略〜 ) MyMac:~ chcoopu$
特に困ることはないけれど、不思議。
もしかしてメモリを増設するとClient VMは起動しなくなる?
といことで、もう少し調べてみる。
man javaしてマニュアルを見てみるとSunのjava1.5のクラス分けに従うとのこと。
http://java.sun.com/j2se/1.5.0/docs/guide/vm/server-class.html
ということで、2CPU(おそらく2コアでも)かつ2GB以上のメモリを持ったマシンの場合はServer VMが選ばれるとのこと。
しかし、この話は両方のVMが提供されている環境の場合のこと。「-client」や「-server」を使えば提供されていればそれが起動するはずなのに。
あー、マニュアルは古いままっぽい。
23 June 2004 java(1)
ADCのjava FAQによるとjava5の32ビット版Client VMと64ビット版Server VMがあるとのこと。
が、この後Java for Mac OS X Update 2まであがってjava6になった時に消えた?
とりあえず古いjava1.4.2とjava5は残っていた。上記の通りjava5では32ビット版Client VMと64ビット版Server VMが起動した。ん、特に指定しないと32ビット版Client VMが起動したな……
MyMac:~ chcoopu$ ls /System/Library/Frameworks/JavaVM.framework/Versions/
1.3@ 1.4.1@ 1.5.0/ A/
1.3.1/ 1.4.2/ 1.6@ Current@
1.4@ 1.5@ 1.6.0/ CurrentJDK@
MyMac:~ chcoopu$