harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [j9] Doesn't deal with -showversion
Date Thu, 14 Sep 2006 10:10:24 GMT
Geir Magnusson Jr. wrote:
> Oliver and Co :
> I don't know if you caught this in another thread, but I recently
> changed the launcher to pass the "-showversion" cmd line param through
> to the VM after the launcher prints out its version, so that we can also
> know the version of the VM.
> The problem with this brilliant strategy is that J9 doesn't actually
> deal with -showversion.
> Can you add that to the list of things to tweak?  Either silently
> swallow it, or print something useful would be my suggestion...
> geir

Hmm, I'm not convinced that you can expect each VM to respond to
-showversion, we may have to continue to handle that in the launcher.

Certainly another VM in popular usage (Sun 5.0) doesn't recognise it
based on my test code below.

We hacked the harmony launcher code to do the brain-dead thing of
printing out the launcher version, but I agree that it should print more
useful info like the VM + classlib versions.

A reasonable way to get the VM version info would be to create the VM
then print the 'java.vm.version' property value.

If you set the ignoreUnrecognized flag to JNI_TRUE then the VM is
created, but does not show the version info of course.

#include <stdio.h>
#include "jni.h"

int main (int argc, char* argv[]) {

  JNIEnv *env;
  JavaVM *vm;
  JavaVMInitArgs vm_args;
  JavaVMOption options[1];
  int rc;

  options[0].optionString = "-showversion";

  vm_args.version = JNI_VERSION_1_2;
  vm_args.options = options;
  vm_args.nOptions = 1;
  vm_args.ignoreUnrecognized = JNI_FALSE;

  rc = JNI_CreateJavaVM(&vm, (void **)&env, &vm_args);
  if (rc < 0) {
    printf("Failed to create VM with rc=%d.", rc);
  } else {
    printf("Created VM successfully.");




Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message