O Java VM padrão é definido no arquivo jvm.cfg
. No Windows, isso está na sua pasta Java em C:\Program Files
, no Linux, o caminho pode variar.
No meu sistema Ubuntu 12.04 amd64 com o Oracle Java JDK7 instalado através do Webupd8 ppa , o arquivo está em /usr/lib/jvm/java-7-oracle/jre/lib/amd64
. Para o padrão OpenJDK 6, o arquivo está em /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/jvm.cfg
. Note que você precisa do JDK e não apenas do JRE instalado.
Edite o jvm.cfg
que corresponde à sua versão Java padrão atual ( sudo nano /usr/lib/jvm/java-7-oracle/jre/lib/amd64/jvm.cfg
). Mude -server KNOWN
para -server IGNORE
e -client IGNORE
para -client KNOWN
.
Isso tornará o -client flag
"conhecido" para o executável java e fará com que ele ignore o -server flag
, tornando-o padrão.
O arquivo original (cliente vm como padrão):
# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
# ORACLE 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
-client IGNORE
-hotspot ERROR
-classic WARN
-native ERROR
-green ERROR
Arquivo modificado (servidor vm como padrão):
# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
# ORACLE 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
-server IGNORE
#-client IGNORE
-client KNOWN
-hotspot ERROR
-classic WARN
-native ERROR
-green ERROR
Agora teste para ver se a alteração funcionou:
$ java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
Fonte