@@ -23,6 +23,7 @@ import { workspace } from 'vscode';
2323import * as _ from "lodash" ;
2424import * as fse from "fs-extra" ;
2525import * as cp from 'child_process' ;
26+ import * as path from "path" ;
2627import { JavaUtils } from '../tooling/utils/JavaUtils' ;
2728
2829export class JDKVersion {
@@ -291,11 +292,16 @@ export class JDKVersion {
291292 }
292293 }
293294
294- public static isCorrectJDK ( jdkVersion : JDKVersion ,
295+ public static isCorrectJDK (
296+ jdkVersion : JDKVersion ,
295297 vendor : string | undefined ,
296298 minVersion : JDKVersion | undefined ,
297- maxVersion : JDKVersion | undefined ) : boolean {
299+ maxVersion : JDKVersion | undefined ,
300+ jvmOption : string | undefined ,
301+ javaHome : string | undefined ) : boolean {
302+
298303 let correctJDK : boolean = true ;
304+
299305 if ( vendor !== undefined ) {
300306 let jdkVendor : string | undefined = jdkVersion . getVendor ( ) ;
301307 if ( jdkVendor ) {
@@ -304,15 +310,33 @@ export class JDKVersion {
304310 correctJDK = false ;
305311 }
306312 }
313+
307314 if ( correctJDK && minVersion ) {
308315 correctJDK = jdkVersion . ge ( minVersion ) ;
309316 }
317+
310318 if ( correctJDK && maxVersion ) {
311319 correctJDK = jdkVersion . le ( maxVersion ) ;
312320 }
321+
322+ if ( correctJDK &&
323+ jvmOption &&
324+ / ^ - X X : [ + - ] ? C R a C .* / . test ( jvmOption ) ) {
325+
326+ correctJDK = JDKVersion . isCRaCJDK ( javaHome ) ;
327+ }
328+
313329 return correctJDK ;
314330 }
315331
332+ public static isCRaCJDK ( javaHome : string | undefined ) : boolean {
333+ if ( ! javaHome ) {
334+ return false ;
335+ }
336+ const criuPath = path . join ( javaHome , "lib" , "criu" ) ;
337+ return fse . pathExistsSync ( criuPath ) ;
338+ }
339+
316340 /**
317341 * Parses the java version text
318342 *
0 commit comments