You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Geir Magnusson Jr." <ge...@pobox.com> on 2006/09/13 13:57:14 UTC

[j9] Doesn't deal with -showversion

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

---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.
You are correct.  As I recall, I've never seen J8 actually output a 
version, ever.  It's always been the launcher's version msg.

geir

Oliver Deakin wrote:
> Is it just me, or does something similar happen with -version? I get:
> 
> $ java -version
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software 
> Foundation or its licensors, as applicable.
> JVMJ9VM007E Command-line option unrecognised: -version
> HMYEXEL062E Internal VM error: Failed to create Java VM
> FAILED.
> 
> Ill take a look at this too.
> 
> Regards,
> Oliver
> 
> 
> 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
>>
>> ---------------------------------------------------------------------
>> 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
>>
>>
> 

---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by Oliver Deakin <ol...@googlemail.com>.
Is it just me, or does something similar happen with -version? I get:

$ java -version
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software 
Foundation or its licensors, as applicable.
JVMJ9VM007E Command-line option unrecognised: -version
HMYEXEL062E Internal VM error: Failed to create Java VM
FAILED.

Ill take a look at this too.

Regards,
Oliver


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
>
> ---------------------------------------------------------------------
> 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
>
>

-- 
Oliver Deakin
IBM United Kingdom Limited


---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.

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.

I think the decision will be if we care about other unrelated VMs for 
the launcher.

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

I'm not too worried about that. :)

> 
> 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.

Yep

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

That's a good approach, I suppose. On the list... right now we can 
survive as we took out the flag in the test suite, but would be nice to 
get working again.

> 
> 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: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [j9] Doesn't deal with -showversion

Posted by Alexey Varlamov <al...@gmail.com>.
2006/9/14, Geir Magnusson Jr. <ge...@pobox.com>:
>
>
> 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...
>

Good point.
I also wonder how our tools handle such option, can the launcher interfere?
--
Alexey

---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.

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: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [j9] Doesn't deal with -showversion

Posted by "Geir Magnusson Jr." <ge...@pobox.com>.

Gregory Shimansky wrote:

> 
> The "-help" and especially "-X" help contents may actually depend on the 
> invoked VM as well. So maybe it makes sense to move their text into property 
> as well, or how would the launcher know what to print in help for VM 
> specific "-X" options help?

-help and -Xhelp are passed through to the VM.  If it can't find a VM, 
it just shows it's own launcher help.


> BTW for RI when "-help" or "-X" are specified it 
> doesn't matter if main class was specified, it just prints help and exits.
> 
> This is not about non-harmony VMs. It is about specifics about different 
> harmony VMs.
> 

---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by Gregory Shimansky <gs...@gmail.com>.
On Thursday 14 September 2006 17:48 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.
>
> 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?

The "-help" and especially "-X" help contents may actually depend on the 
invoked VM as well. So maybe it makes sense to move their text into property 
as well, or how would the launcher know what to print in help for VM 
specific "-X" options help? BTW for RI when "-help" or "-X" are specified it 
doesn't matter if main class was specified, it just prints help and exits.

This is not about non-harmony VMs. It is about specifics about different 
harmony VMs.

-- 
Gregory Shimansky, Intel Middleware Products Division

---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by Oliver Deakin <ol...@googlemail.com>.
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.

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?

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
>
>   

-- 
Oliver Deakin
IBM United Kingdom Limited


---------------------------------------------------------------------
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


Re: [j9] Doesn't deal with -showversion

Posted by Tim Ellison <t....@gmail.com>.
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.");
    (*vm)->DestroyJavaVM(vm);
  }

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

Regards,
Tim

-- 

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


Re: [j9] Doesn't deal with -showversion

Posted by Oliver Deakin <ol...@googlemail.com>.
Hi Geir,

I just spotted that in the other thread as Im catching up with my mail.
Ill take a look at it and see if we can get it fixed in the next VME
version.

Regards,
Oliver

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
>
> ---------------------------------------------------------------------
> 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
>
>

-- 
Oliver Deakin
IBM United Kingdom Limited


---------------------------------------------------------------------
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