Oliver Deakin wrote:
Tim Ellison wrote:
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.

Agreed, this sounds like a reasonable alternative to printing version information
from the launcher, or expecting all Harmony compatable VMs to accept
-showversion/-version.

We expect so much out of Harmony compatible VMs, we're worried about one cmd line flag?


Can I suggest a start sequence similar to the following:
1) If no options or classes are specified, print help and exit
2) If -version, create VM (without -version option) and print java.vm.version property. Exit. 3) If -showversion, create VM (without -showversion option) and print java.vm.version. Go to 5. 4) If neither -version nor -showversion are specified, create VM with specified options. Go to 5. 5) If VM creation returns successfully, check if a main class has been specified. If not, print help information, destroy the VM and exit (we currently do not print help at this point).
6) If a class has been specified, launch main().

Does that sound right?

That's fine, but I'm still wondering why we're so concerned about other VMs that wouldn't support anything else in harmony...

geir


Regards,
Oliver

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.");
    (*vm)->DestroyJavaVM(vm);
  }

  return(0);
}
-------------------------------------------------

Regards,
Tim



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to