How to detect that a VM was started with --enable-preview ?

Mandy Chung mandy.chung at oracle.com
Tue Oct 9 18:09:46 UTC 2018


I think this RFE is what you are looking for:
     https://bugs.openjdk.java.net/browse/JDK-8194138

Mandy

On 10/9/18 8:47 AM, 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" <sean.coffey at oracle.com>
>> À: "Remi Forax" <forax at univ-mlv.fr>, "core-libs-dev" <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