> De: "mandy chung" <mandy.ch...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr>, "Seán Coffey" <sean.cof...@oracle.com> > Cc: "core-libs-dev" <core-libs-dev@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:fo...@univ-mlv.fr | fo...@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.cof...@oracle.com | >>> <sean.cof...@oracle.com> ] >>> À: "Remi Forax" [ mailto:fo...@univ-mlv.fr | <fo...@univ-mlv.fr> ] , >>> "core-libs-dev" [ mailto:core-libs-dev@openjdk.java.net | >>> <core-libs-dev@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()