1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cannot switch java VM

Discussion in 'Installation and Maintenance of Ports or Packages' started by mky, Sep 27, 2010.

  1. mky

    mky New Member

    Messages:
    32
    Likes Received:
    0
    Hi,
    I have installed two versions of java and javavm wrapper:
    Code:
    diablo-jdk-1.6.0.07.02_10 Java Development Kit 1.6.0_07.02
    javavmwrapper-2.3.5 Wrapper script for various Java Virtual Machines
    openjdk6-b20_3      Oracle's Java 6 virtual machine release under the GPL v2
    
    I tried to switch between this javas, removing one of this from /usr/local/etc/javavms but it always run diablo-jdk. I also tried unregister one of VM, using
    # unregistervm /usr/local/diablo-jdk1.6.0/bin/java
    It also doesn't work for me. When I check current version of java, I have:
    Code:
    $ 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)
    
    How can I switch properly to other java VM? I would like to run always openjdk when I need, and sometimes diablo-jdk for compatibility issues (eg. for JDownloader).
     
  2. achix

    achix New Member

    Messages:
    241
    Likes Received:
    0
    Sorry to come to this late. The reason you are facing this, is because javavm wrapper port has gotten extremely misleading. Solve this by applying this patch to /usr/ports/Mk/bsd.java.mk
    Code:
    *** bsd.java.mk.orig	2011-03-27 08:33:34.000000000 +0300
    --- bsd.java.mk	2011-03-27 08:42:33.000000000 +0300
    ***************
    *** 212,217 ****
    --- 212,219 ----
      # Enforce preferred Java ports according to OS
      .		if (${OSVERSION} >= 600000 && ${OSVERSION} < 800000)
      _JAVA_PREFERRED_PORTS+=	JAVA_PORT_NATIVE_FREEBSD_JDK_1_6
    + .		else if (${OSVERSION} >= 800000)
    + _JAVA_PREFERRED_PORTS+=	JAVA_PORT_NATIVE_OPENJDK_JDK_1_6
      .		else
      _JAVA_PREFERRED_PORTS+=	JAVA_PORT_NATIVE_BSDJAVA_JDK_1_6
      .		endif
    
     
  3. achix

    achix New Member

    Messages:
    241
    Likes Received:
    0
  4. achix

    achix New Member

    Messages:
    241
    Likes Received:
    0
    update:
    make else if->elif