@@ -576,25 +576,35 @@ public List<Path> getBuilderModulePath() {
576576 }
577577
578578 private List <Path > createTruffleBuilderModulePath () {
579- List <Path > jars = getJars (rootDir .resolve (Paths .get ("lib" , "truffle" )), "truffle-api" , "truffle-runtime" , "truffle-enterprise" );
579+ Path libTruffleDir = rootDir .resolve (Paths .get ("lib" , "truffle" ));
580+ List <Path > jars = getJars (libTruffleDir , "truffle-api" , "truffle-runtime" , "truffle-enterprise" );
580581 if (!jars .isEmpty ()) {
581582 /*
582583 * If Truffle is installed as part of the JDK we always add the builder modules of
583584 * Truffle to the builder module path. This is legacy support and should in the
584585 * future no longer be needed.
585586 */
586- jars .addAll (getJars (rootDir . resolve ( Paths . get ( "lib" , "truffle" )) , "truffle-compiler" ));
587+ jars .addAll (getJars (libTruffleDir , "truffle-compiler" ));
587588 Path builderPath = rootDir .resolve (Paths .get ("lib" , "truffle" , "builder" ));
588589 if (Files .exists (builderPath )) {
589590 jars .addAll (getJars (builderPath , "truffle-runtime-svm" , "truffle-enterprise-svm" ));
591+ if (libJvmciDir != null ) {
592+ // truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
593+ // JDKs
594+ jars .addAll (getJars (libJvmciDir , "polyglot" ));
595+ }
596+ }
597+ if (libJvmciDir != null ) {
598+ // truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
599+ jars .addAll (getJars (libTruffleDir , "jniutils" ));
590600 }
591601 }
592602 /*
593603 * Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
594604 * image builder still needs it
595605 */
596606 if (libJvmciDir != null ) {
597- jars .addAll (getJars (rootDir . resolve ( Paths . get ( "lib" , "truffle" )) , "truffle-compiler" ));
607+ jars .addAll (getJars (libTruffleDir , "truffle-compiler" ));
598608 }
599609
600610 return jars ;
0 commit comments