how does "javavms" work?

Alfred Bartsch bartsch at dssgmbh.de
Fri May 11 12:36:22 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 27.04.2012 20:53, schrieb Chad Leigh Shire.Net LLC:
> Hi
> 
> Not the behind the scenes really.   Just how do I use it?
> 
> I installed OpenJDK7 from ports.  As part of that it installed the
> Diablo stuff (Java 6).
> 
> the /usr/local/etc/javavms  file listed both.  But when I edited
> this file to only have the OKDK 7 version, it still runs the Diable
> JDK 6 stuff when I type "java" at the command line.
> 
> I read the man file on javavms and used registervm and unregistervm
> and javavms only lists the OpenJDK 7 version but if I do
> 
> # java -version java version "1.6.0_07" Diablo Java(TM) SE Runtime
> Environment (build 1.6.0_07-b02) Diablo Java HotSpot(TM) 64-Bit
> Server VM (build 10.0-b23, mixed mode) #
> 

Normally, the Diablo stuff is installed as a build dependency to
compile the openjdk stuff, and can safely be removed afterwards.
But you may keep both JVMS, or you may install even some more.
In these cases javavmwrapper kicks in and lets you choose your
preferred JVM.

Unfortunately, javavmwrapper behaves differently, whether it sees an
installed portstree (/usr/ports/Mk/bsd.java.mk) or not.
It is my experience that the wanted priority of JVMs due to
/usr/local/etc/javavms is only guaranteed, if there is no portstree
available.

So I decided to patch the javavm wrapper skript
(/usr/local/bin/javavm) to remove these unwanted features. Now
everything works for me as expected.

The attached patch file applies to an installed javavmwrapper-2.3.5
port. You may alternatively just remove those lines from the script file.

HTH

P.S.: I'm thinking of filing a PR, since it looks like a bug.
- -- 
Alfred Bartsch
Data-Service GmbH
mailto:bartsch at dssgmbh.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+tB7wACgkQ5QGe2JdVf3g4MwCeO+POVkgOVEYs6yrD4DedfwD3
XacAoLpEI04nrdZq3/iQVFK3QUry/doy
=sOgr
-----END PGP SIGNATURE-----
-------------- next part --------------
--- javavm.orig	2011-09-30 04:40:51.000000000 +0200
+++ javavm	2012-05-11 09:07:53.000000000 +0200
@@ -493,30 +493,6 @@
 
     unset JAVA_HOME
 
-    # Determine location of bsd.port.mk if it exists
-    _JAVAVM_PORTSDIR=
-    if [ -r /usr/share/mk/bsd.port.mk ]; then
-        _JAVAVM_PORTSDIR=`"${_JAVAVM_MAKE}" -f /usr/share/mk/bsd.port.mk -V PORTSDIR 2>/dev/null`
-    fi
-
-    _JAVAVM_BSD_PORT_MK=
-    if [ -n "${_JAVAVM_PORTSDIR}" -a -r "${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk" ]; then
-        _JAVAVM_BSD_PORT_MK="${_JAVAVM_PORTSDIR}/Mk/bsd.port.mk"
-    fi
-
-    # If bsd.port.mk was found, use that to determine the VM to use.
-    if [ -n "${_JAVAVM_BSD_PORT_MK}" ]; then
-        JAVA_HOME=`"${_JAVAVM_MAKE}" -f "${_JAVAVM_BSD_PORT_MK}" -V JAVA_HOME USE_JAVA=yes 2>/dev/null`
-        if [ -n "${JAVA_HOME}" -a -f "${JAVA_HOME}/bin/${_JAVAVM_PROG}" ]; then
-            _JAVAVM_PROG_PATH="${JAVA_HOME}/bin"
-            return 0
-        elif [ -n "${JAVA_HOME}" -a \
-               -f "${JAVA_HOME}/jre/bin/${_JAVAVM_PROG}" ]; then
-            _JAVAVM_PROG_PATH="${JAVA_HOME}/jre/bin"
-            return 0
-        fi
-    fi
-
     # Then try to make sure that ${_JAVAVM_CONF} exists
     if [ ! -e "${_JAVAVM_CONF}" ]; then
         echo "${_JAVAVM_PROG}: error: can't find ${_JAVAVM_CONF} configuration file" 1>&2


More information about the freebsd-java mailing list