How to detect that a VM was started with --enable-preview ?
forax at univ-mlv.fr
forax at univ-mlv.fr
Tue Oct 9 18:47:18 UTC 2018
> De: "mandy chung" <mandy.chung at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "Seán Coffey" <sean.coffey at oracle.com>
> Cc: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mardi 9 Octobre 2018 20:09:46
> Objet: Re: How to detect that a VM was started with --enable-preview ?
> I think this RFE is what you are looking for:
> [ https://bugs.openjdk.java.net/browse/JDK-8194138 |
> https://bugs.openjdk.java.net/browse/JDK-8194138 ]
> Mandy
yes !
Having the feature version of the current runtime (Runtime.version().feature()) already give me the highest major version of the classfile that the current VM can recognize, but not the minor one.
thanks,
Rémi
> On 10/9/18 8:47 AM, [ mailto:forax at univ-mlv.fr | forax at univ-mlv.fr ] wrote:
>> Ah, sorry,
>> i mean detecting if the VM was started with --enable-preview when you are
>> running a code on that VM.
>> Basically, i want to programmatically know if i can generate and load a class
>> with the minor version equals to 65535 on that VM or not ?
>> cheers,
>> Rémi
>> ----- Mail original -----
>>> De: "Seán Coffey" [ mailto:sean.coffey at oracle.com | <sean.coffey at oracle.com> ]
>>> À: "Remi Forax" [ mailto:forax at univ-mlv.fr | <forax at univ-mlv.fr> ] ,
>>> "core-libs-dev" [ mailto:core-libs-dev at openjdk.java.net |
>>> <core-libs-dev at openjdk.java.net> ] Envoyé: Mardi 9 Octobre 2018 17:27:41
>>> Objet: Re: How to detect that a VM was started with --enable-preview ?
>>> would `jcmd <pid> VM.info | grep jvm_args:` help ? or `jcmd <pid>
>>> VM.command_line`
>>> regards,
>>> Sean.
>>> On 09/10/2018 16:20, Remi Forax wrote:
>>>> Hi all,
>>>> it seems that there is no simple way* to detect if a VM is started with
>>>> --enable-preview or not ?
>>>> Rémi
>>>> * apart using JMX to sniff the VM command line with
>>>> ManagementFactory.getRuntimeMXBean().getInputArguments()
More information about the core-libs-dev
mailing list