OSXのJVMはClientとServerで違っていた・・
常識?かも知れないのですが、自分は今の今まで知らなかったのでメモ・・
昨日ちょっといろいろトラブっていて環境調査をしていて気がつきました。
$ java -version java version "1.5.0_13" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241) Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)
OSX Tiger Server (XServe G5)での表示
$ java -version java version "1.5.0_13" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241) Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode)
よーく目を凝らしてみると、Server版にはsharingの文字がありません。
どういう事か調べてみたら、sharingがつくモードはクライアント版のJVMだと言う事が解りました。
という事は、OSX Serverで何も考えずにjavaを起動すると、それは「-server」オプションをつけて起動したのと同じ事という訳ですね。*1
いったいその違いはどこで設定されているのか調べてみると、/Library/Java/Home/lib/jvm.cfg にどのVMを起動するかの設定が書かれていました。ぜんぜん知らなかったよ!(恥)
$ cat /Library/Java/Home/lib/jvm.cfg # # @(#)jvm.cfg 1.6 01/12/03 # # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # # # # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. # NOTE that this both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=<jvm_dir>" option, but that too is unsupported # and may not be available in a future release. # -client KNOWN -jvm ALIASED_TO -client -hotspot ALIASED_TO -client -server KNOWN -classic WARN
$ cat /Library/Java/Home/lib/jvm.cfg # # @(#)jvm.cfg 1.6 01/12/03 # # Copyright 2002 Sun Microsystems, Inc. All rights reserved. # SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # # # # # List of JVMs that can be used as an option to java, javac, etc. # Order is important -- first in this list is the default JVM. # NOTE that this both this file and its format are UNSUPPORTED and # WILL GO AWAY in a future release. # # You may also select a JVM in an arbitrary location with the # "-XXaltjvm=<jvm_dir>" option, but that too is unsupported # and may not be available in a future release. # -server KNOWN -jvm ALIASED_TO -client -hotspot ALIASED_TO -client -client KNOWN -classic WARN
よーく目を凝らしてみると、-serverと-clientの順序が入れ替わっている・・*2
という訳で、知らず知らずのうちにServer版のJVMを使っている可能性もあるね、と言うお話でした。